Assignment 1 Solution

$30.00

Description

  1. Consider there are n (take input value of n from user) students. Read name of the students from user and store the name of the students in an array (Assume that names are unique).

    1. Now create a linked list where each node of that linked list will contain a part of student‟s name which unambiguously distinguishes students. Sort the name in dictionary order. Go through sorted linked list and print full name. Example: Names in array:: Aloke, Anirudh, Anirban, Aniket, Animesh, Hridesh names in listAl, Aniru, Anirb, Anik, Anim, H Sorted names in array Al, Anik, Anim, Anirb, Aniru, H names to be printed :: Aloke, Aniket, Animesh, Anirban, Anirudh, Hridesh

Upload : assign1Aa.c

    1. Create two single linked list of nearby equal size (x=n/2 and y=n/2 if n is even x=n/2 and y=n-n/2 if n is odd) where first list will have details of first x students and second list will have details of last y students. Each node of the list will contain only the first letter of the name. Now arrange each linked list in such a way that node with vowels comes before node with consonant. However, you have to make sure that nodes with vowels maintain their order among themselves as per arrival (entry order from user) and similarly nodes with consonants also maintain their order. Comment if any of these two linked list or any sublist (part of the list having more than one element) are palindrome. Example: Michael, Alexander, Ethan, Jacob, Mason,Firoz, Noah, Liam, Poli, Samuel, Noman, Alle

Linked List: M-> A-> E-> J->M->F and N->L->P->S->N->A Arranged linked list A->E->M->J->M->F and A->N->L->P->S->N, M->J->M is a palindrome.

Upload : assign1Ab.c

  1. Baby Shanaya loves chocolates. There are N boxes, each box contains certain amount of chocolates. Baby Shanaya wants to take out maximum chocolates from the given boxes. But her elder brother put one condition that she can‟t take out chocolates from two consecutive boxes. So she needs your help. Help her by writing a C code such that she will get maximum number of chocolates. (Example: Box1, Box2, Box3, Box4, Box5 contains 7,1,2,8,3 chocolates respectively then you will give her 7+8=15 chocolates).(b) Now pass the answer of part-a to a function LargeDigit( ) as an argument, which will find out the largest digit in the given number using recursion.

Input:

5 //number of boxes

7 1 2 8 3 //Chocolates in the boxes Output:

15 //answer of part-a

5 //largest digit in answer of part-a

Upload : assign1B.c

  1. Create a structure representing a book having attributes “S.No”, “Title”, “Author” and “Issue Status”. Write a program such that a user can choose any of following six options:

    1. Make a new entry of book

    2. View Details of a book

    3. Show list of available books

    4. Issue a book

    5. Return a book

    6. Exit

For making a new entry, the book details should be entered by the user and the “Issue Status” should always be „Not Issued‟ for this. All the attributes excluding „Issue status‟ should be asked from the user. After making an entry a „New Entry Successful‟ message should be displayed.

When option of “View Details of a book” is chosen, then user should get another menu

  1. By serial No.

  2. By Title

  3. By Author

If there is more than one book with same author and option iii) “By author” is chosen then details of all books by that author need to be displayed.

Show list of available books should display details of all books for which status is “Not Issued”

Issue a book can be done only using serial no and “Issue Status” should be modified to “Issued” from “Not Issued”

Return a book can be done only using serial no and “Issue Status” should be modified to “Not Issued” from “Issued”

Appropriate error message should be printed if any wrong option is chosen or undesired input is provided.

Upload : assign1C.c


error: Content is protected !!