Untitled5 - Arup Guha edited for COP 3502 Lecture Linked List Example Edited in class on to show how to insert into a circularly linked

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// Arup Guha // 10/24/01 edited 2/24/04 for COP 3502 Lecture // Linked List Example / // Edited in class on 1/28/08 to show how to insert into a circularly linked // list. / #include <stdio.h> #include <stdlib.h> # // Struct used to form a linked list of integers. struct ll { s int data; struct ll *next; }; } void print(struct ll *front); v struct ll* insert_front(struct ll *front, int num); struct ll* insert_inorder(struct ll *front, int num); struct ll* insert_back(struct ll *front, int num); s int main() { i struct ll *randlist=NULL; struct ll *inorderlist=NULL; // Test out some functions on randlist. randlist = insert_front(randlist,5); print(randlist); randlist = insert_back(randlist,2); print(randlist); randlist = insert_front(randlist, 1); print(randlist); randlist = insert_front(randlist, 6); randlist = insert_front(randlist, 9); randlist = insert_front(randlist, 8); randlist = insert_back(randlist, 7); print(randlist); // Test out some functions on inorderlist. inorderlist = insert_inorder(inorderlist, 4); inorderlist = insert_inorder(inorderlist, 2); inorderlist = insert_inorder(inorderlist, 9); print(inorderlist); inorderlist = insert_inorder(inorderlist, 1);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 07/12/2009.

Page1 / 4

Untitled5 - Arup Guha edited for COP 3502 Lecture Linked List Example Edited in class on to show how to insert into a circularly linked

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online