int main(int argc, const char * argv[]) { //printList(appendNode(&(BuildWithLocalRef()), 2)); //doesn't work? &(2376ut) doesn't work not a lvalue Node* head=BuildOneTwoThree(); appendNodeWithPush(&head, 4); appendNode(&head, 4); appendNode(&head, 4); Node* test5=BuildWithLocalRef(); Push(&test5, 6); insertNth(&test5, 4, 3); //printList(test5); insertSort(&test5); append(&test5, &head); //printList(test5); Node *first=NULL,*second=NULL; //pop(&test5); //split(test5, &first, &second); //printList(first); //printList(second); //removeDuplicates(second); //printList(first); //printList(second); //moveNode(&first, &second); //printList(first); //printList(second); alternatingSplit(test5, &first, &second); //printList(first); //printList(second); //Node* test=shuffleMergeRecursive(first, second); //printList(test); Node* test1=BuildOneTwoThree(); Node* test2=BuildOneTwoThree(); pop(&test2); appendNode(&test2, 7);; appendNode(&test1, 5); //printList(test1); //printList(test2); append(&test1, &test2); //printList(test1); mergeSort(&test1); //printList(test1); Node* t4=BuildOneTwoThree(); Node* t5=BuildOneTwoThree(); appendNode(&t5, 6); appendNode(&t4, 6); appendNode(&t4, 7); appendNode(&t5, 8); Push(&t5, 0); Push(&(t5->next), 1); //printList(t5); //printList(t4); //printList(sortedIntersect(t4, t5)); recursiveReverse(&t5); printList(t5); return 0; }
int main(){ int c, n, r; do { printf("0. Show\n"); printf("1. Append\n"); printf("2. Push\n"); printf("3. pop\n"); printf("4. Count Nodes\n"); printf("5. Get nth element\n"); printf("6. Delete List\n"); printf("7. Insert at nth index\n"); printf("8. InsertSort the List\n"); printf("9. FrontBackSplit\n"); printf("10. Remove Duplicates\n"); printf("11. Reverse the List\n"); printf("12. Alternating Split\n"); printf("13. Make a Dummy List\n"); printf("14. Shuffle Merge\n"); printf("15. EXIT\n"); printf("Your Choice : "); scanf("%d", &c); switch(c){ case 0 : show(); break; case 1 : printf("Enter a number : "); scanf("%d", &n); append(n); break; case 2 : printf("Enter a number : "); scanf("%d", &n); push(n); break; case 3 : if((r = pop()) > 0) printf("%d\n", r); else printf("List Empty\n"); break; case 4 : printf("%d\n", countNodes()); break; case 5 : printf("Enter the index : "); scanf("%d", &n); ((r = getNth(n)) >= 0) ? printf("%d\n", r) : printf("Index out of Range\n"); break; case 6 : deleteList(); break; case 7 : printf("Enter the index and the number : "); scanf("%d%d", &r, &n); if(insertNth(r, n) < 0) printf("Index out of Range. Aborting..."); break; case 8 : insertSort(); break; case 9 : frontBackSplit(); break; case 10: removeDuplicate(); break; case 11: reverse(); break; case 12: alternatingSplit(); break; case 13: makeDummyList(); break; case 14: shuffleMerge(); break; case 15: exit(0); default: printf("wrong Choice\n"); exit(0); } }while(c >= 0 && c <= 14); }