Looking to test my library and implementing it so that insert function can assign the index of the rear in th e ring after the items are inserted in ring class CircularQueue: def __init__(self, size): """ ------------------------------------------------------- Initializes an empty queue. Data is stored in a list. ------------------------------------------------------- Postconditions: Initializes an empty queue. ------------------------------------------------------- """ self._values = [None] * size return def is_empty(self): """ ------------------------------------------------------- Determines if the list is empty. Use: b = l.is_empty() ------------------------------------------------------- Postconditions: Returns True if the list is empty, False otherwise. ------------------------------------------------------- """ return len(self._values) == 0 def insert(self, value): """ ------------------------------------------------------- Inserts a copy …

Member Avatar
Member Avatar
+0 forum 3

hi ! how can i do a one-way-circular linked list function that gives to me** merge 3 lists** such as struct node{ int data; node *flink; node *blink; }; void concatenate(node *&L1,node *L2,node *L3) { ??? }

Member Avatar
Member Avatar
+0 forum 2

ok, im working on an assignment implementing a circular queue (fixed size 15), shared memory, normal producer consumer problem, using three semaphores (one for the queue and one for each process). The objective is to have the producer put the characters from mytest.dat (max 150 chars) into a circular queue, while the consumer pulls them and outputs them to the screen. The exit condition for the consumer is the character `*` (which should not be output). Currently the producer does pull the information, however the consumer outputs blank characters and then hangs. Any pointers (no pun intended) would be greatly …

Member Avatar
Member Avatar
+0 forum 1

Hi All, I am quite stuck in an operation where I have to calculate a sum using circular reference. Though in Excel , it's quite easy (or already managed by excel itself) to use circular reference but I am not sure how to implement this thing in C#. The problem is like this: I have to sum a whole range of cells and then two values in cells use the sum itself for their own calculation.that is, if i have sum = num1 + num2 + num3 + num4, then num2 = someVariable + sum/someVariable2; and similarly num4 also uses …

Member Avatar
Member Avatar
+0 forum 2

struct looks like this: [CODE] struct ListNode; typedef ListNode* ListType; struct details { char first_name[20]; char last_name[20]; int start_number; int end_number; }; struct ListNode { details data; ListType next; }; ListType list = NULL; ListType head = NULL; ListType * PointerToHead = &head; [/CODE] I have a circular linked list that i bubblesort, and the swap function for it now looks like this: [CODE] void Swap(ListType& a, ListType& b)//when called b is always a->next { ListType prevNodeA; ListType tempPtr = a; ListType AfterNodeB = b->next; while(tempPtr->next!=a)//find the node before a { tempPtr = tempPtr->next; } if(tempPtr->next==a) { prevNodeA = tempPtr; …

Member Avatar
+0 forum 0

Hello Guys, I'm new here and I would like to ask help from you in making circular queue. I'm solving these for days but I can't have any idea anymore to solve for it's algorithm... I made this code so far... [CODE]#include <iostream> #define SIZE 5 using namespace std; int queueArr[SIZE]; void dequeue(); void enqueue(int); void display(); int front(-1); int rear(-1); int main(){ while(1){ int choice; system("cls"); cout << "[1] - Enqueue\n"; cout << "[2] - Dequeue\n"; cout << "[3] - Display\n"; cout << "[4] - Exit\n"; cout << "===================\n"; cout << "Enter your choice: "; cin >> choice; switch(choice){ …

Member Avatar
Member Avatar
+0 forum 8

hi; I'm trying to program a circular link list with a head node , I have a problem with insert function . wanting to do it like this but with a head node >> [url]http://geeksforgeeks.org/wp-content/uploads/cll1.gif[/url] this is my function :: [CODE] struct node{ int data; node *next; node(int x,node *n=NULL){ data=x; next=n; } }; void insert (node *h,int d){ node *p=h; while (p->next!=h && d>p->next->data) p=p->next; p->next =new node(d,p->next); } [/CODE]

Member Avatar
Member Avatar
+0 forum 10

How do you grow a circular array? I have a front, I have a back, I have a current_size, I have a maximum_size, and of course I have the array. So, how do you grow a circular array? Thank you kindly!

Member Avatar
Member Avatar
+0 forum 9

Hi, I need to develop a C# console application which implements stack as a circular queue. I've written the code to use stack as a simple queue. [CODE]using System; public class Stack { private int[] theArray; private int topOfStack; public Stack() { theArray = new int[10]; topOfStack = -1; } public bool isEmpty() { return topOfStack == -1; } public void push(int data) { if (topOfStack < 10) { topOfStack++; theArray[topOfStack] = data; } } public int pop() { if (!isEmpty()) return theArray[topOfStack--]; else return -1; } public void display(int flag) { if(flag == 0) //display outStack for (int i …

Member Avatar
Member Avatar
+0 forum 1

Hi everyone. I was trying to solve Pb 35 on Project Euler ([url]http://projecteuler.net/index.php?section=problems&id=35[/url]). It essentially asks to write a program to list all circular primes under 1e6. I wrote the program and it works well for the most part. However, in the end it seems not to be able to conduct membership tests properly. For example, it lists 391 as a prime. I have looked it over and over but I can't figure out what's wrong. I will probably also try a new approach, but I want to know why this doesn't work. I [I]am[/I] new to programming, so please …

Member Avatar
Member Avatar
+0 forum 6

I've got a program that is supposed to mimic a music playlist by implementing a circular, doubly linked list. However, i cant use java's LinkedList, i have to write my own linked list. I have a DblListnode class to keep track of the nodes (show below) [CODE]public class DblListnode { private DblListnode prev; private Object data; private DblListnode next; public DblListnode() { this(null, null, null); } public DblListnode(Object d) { this(null, d, null); } public DblListnode(DblListnode p, Object d, DblListnode n) { prev = p; data = d; next = n; } public Object getData() { return data; } public …

Member Avatar
+0 forum 0

Hello has anybody come across a similar control to this one. [URL="http://img138.imageshack.us/img138/875/23102010172021.png"]http://img138.imageshack.us/img138/875/23102010172021.png[/URL] if so then please give me a link. thank a lot edit : found this one [url]http://www.filebuzz.com/fileinfo/38822/Angulum.html[/url] any better suggs are welcome though :D

Member Avatar
+0 forum 0

The End.