Pop,push,dequeue,enqueue........codes...?

This is a discussion on Pop,push,dequeue,enqueue........codes...? within the C++ Programming forums, part of the General Programming Boards category; Hi there . Am new member as i was searching at the internet about programms i found this site...So ,i ...

  1. #1
    Registered User kardoula's Avatar
    Join Date
    Sep 2011
    Location
    Greece
    Posts
    2

    Pop,push,dequeue,enqueue........codes...?

    Hi there . Am new member as i was searching at the internet about programms i found this site...So ,i study Computer Applications in Management and Economics and in some parts i have trouble. what i mean ,the teacher doesnt explain the lesson so i have some "gabs". If someone knows about pop,push,dequeue...etc...reply please. I need some codes of this programms :-/ The second examination passed and i am afraid of this lesson.
    Thanks .

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Are you referring to the STL and it's implementation of a stack, deque, ect? That really is not a hard internet topic to search for. Read through std::stack and std::deque. If you are talking about implementing your own stack/deque then just google "stack implementation".
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    "Push" adds an element to an array-like structure (one with a linear arrangement of elements, 0, 1, 2, 3, etc.). "Pop" removes it. Wikipedia is a decent source of information for general programming concepts:

    Double-ended queue - Wikipedia, the free encyclopedia

    With regard to a deque you can push and pop from both ends of the array. The best way to learn is to do. Here's something to start you off:

    Code:
    #include <deque>
    #include <iostream>
    
    using namespace std;
    
    int main(void) {
    	deque<int> deck;
    
    	for (int i = 0; i < 10; i++) {
    		deck.push_front(i);
    		deck.push_back(i);
    	}
    
    	while (!deck.empty()) {
    		cout << deck.front() << " ";
    		deck.pop_front();
    	}
    
    	cout << endl;
    
    	return 0;
    }
    Here's some documentation for deque:

    deque - C++ Reference

    Now use that and the code I gave you and go play around until you understand what you need to know. That site, and this one, also have tutorials:

    C++ Language Tutorial - C++ Documentation
    C++ Tutorial - Introduction to C++ - Cprogramming.com

    Have fun
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User kardoula's Avatar
    Join Date
    Sep 2011
    Location
    Greece
    Posts
    2
    i am searching about codes pop,push,enqueue n' deqeue. and explain step by step their operation. where i can search about theses?
    And one more thing....he wanted programs with "simple interconnected lists" (am not ssure if it's right i translate it frm google). so ...he wanted to search+delete nodes...any help???

  5. #5
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Google the following:

    Linked List
    stack implementation
    double ended queue
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with understanding Push/Pop and Enqueue/Dequeue
    By ee1215 in forum C++ Programming
    Replies: 4
    Last Post: 03-30-2011, 02:16 AM
  2. enqueue and dequeue pointer
    By cjwenigma in forum C++ Programming
    Replies: 8
    Last Post: 11-28-2007, 02:21 PM
  3. Dequeue
    By chuy in forum C Programming
    Replies: 7
    Last Post: 04-11-2006, 01:35 PM
  4. dequeue
    By jk81 in forum C Programming
    Replies: 2
    Last Post: 11-27-2002, 08:48 PM
  5. Enqueue
    By evotron in forum C Programming
    Replies: 1
    Last Post: 11-03-2001, 10:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21