Starting from:
$30

$24

Assignment 1 Solution

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).



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 listAl, 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




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







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







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:



Make a new entry of book
View Details of a book
Show list of available books
Issue a book
Return a book
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




By serial No.
By Title
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

More products