KUYRUK (QUEUE) VERİ YAPISI (ENQUEUE AND DEQUEUE)

Veri yapılarının önemli konularından biriside kuyruk veri yapısıdır.Kuyruk veri yapısı adındanda anlaşılacağı üzere ilk giren ilk çıkar yani FIFO mantığıyla çalışır.Burda herbir eleman için bir Node (düğüm) oluşturarak Class yapısının içinde kullandım ve her elemanı önce ittim kuyruğa (ENQUEUE) sonra da çektim kuyruktan DEQUEUE.Şimdi Bunun gerçeklemesini görelim..

Burda Kuyruğa önce 19 tane eleman ittik sonra 10 tane eleman çektik dolayısıyla ilk eklediğimiz 10 tane ilk çıktı.

#include<iostream>
using namespace std;

class Node {
           public:
           Node();
     
           int data;
           Node *NEXT;
           };
          
  Node::Node()
  {
       this->data=0;                  
       this->NEXT=NULL;      
  }        
 
class queue {
            public:
                   queue();
                   void enqueue(int);
                   void dequeue(int);
                   void print()const;
           
            private:
            Node *front;
            Node *rear;
            int counter;
            }; 
           
           
   queue::queue()
   {
      this->front=NULL;                        
      this->rear=NULL;          
      this->counter=0;          
   }        
  
   void queue::enqueue(int A)
   {
        Node *p=new Node;
        p->data=A;
                  if(front==NULL)
                  {
                       front=p;                        
                       rear=p;         
                       front->NEXT=NULL;        
                  }
        else
            {
                rear->NEXT=p;       
                rear=p; 
                rear->NEXT=NULL;
            }
        counter++;
       
   }
  
   void queue::dequeue(int A)
   {
      Node *p1;      
      p1=front; 
      front=front->NEXT;
      cout<<“silinen eleman”<<p1->data<<”  “<<endl;
      delete p1;
      counter–; 
   }
  
   void queue::print()const
   {
      Node *p1;      
      p1=front; 
               while(p1->NEXT!=NULL)
               {
                    cout<<p1->data<<”  “;                                   
                    p1=p1->NEXT;              
               }  
        cout<<endl;
   }

   main()
   {
        queue T;
        for(int i=0;i<20;i++)
        T.enqueue(i);
        T.print();
        for(int j=0;j<10;j++)
        T.dequeue(j);
        T.print();
   system (“pause”);     
   }

MEHMET SALİH DEVECİ

BİLGİSAYAR MÜHENDİSİ YAZILIM UZMANI

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

6 comments

  1. Hello there! I could have sworn I’ve been to this blog before but after looking at many of
    the posts I realized it’s new to me. Nonetheless, I’m certainly happy I came across it and I’ll be bookmarking it and checking back regularly! https://918.network/downloads/86-play8oy

  2. F*ckin’ remarkable issues here. I’m very glad to look your article. Thanks so much and i am taking a look forward to touch you. Will you please drop me a mail?

  3. Throughout the awesome scheme of things you get a B+ just for hard work. Where you actually misplaced us was first on your facts. As it is said, details make or break the argument.. And that couldn’t be much more accurate at this point. Having said that, let me inform you what did deliver the results. The text can be extremely powerful and this is most likely the reason why I am making the effort to comment. I do not make it a regular habit of doing that. Next, whilst I can certainly see a jumps in logic you come up with, I am not sure of just how you seem to connect your points which produce the actual conclusion. For now I shall subscribe to your point but trust in the foreseeable future you actually connect the dots better.

  4. Wonderful beat ! I would like to apprentice whilst you amend your site, how could i subscribe for a weblog site? The account aided me a appropriate deal. I had been a little bit familiar of this your broadcast provided vibrant clear idea

  5. Glad I discovered this on google .

  1. Pingback: camo phone case

Leave a Reply

Your email address will not be published. Required fields are marked *