0% found this document useful (0 votes)
89 views

Assignment - 1 (17 July To 21 July) (Practice Assignment) : (1) Conversion Between Number Systems

The document outlines a practice programming assignment involving various data structures and algorithms. It includes: 1) Converting numbers between decimal, binary, octal, and hexadecimal number systems using functions with pointers. 2) Taking student data as input and sorting/displaying by name, enrollment number, and subject marks using arrays. 3) Creating a linked list to store integers, search/add values, and sort using various algorithms while comparing performance. 4) Designing a library management application and book transaction system using linked lists. 5) Creating sorted merged linked lists and calculating/modifying element sums.

Uploaded by

Ritik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

Assignment - 1 (17 July To 21 July) (Practice Assignment) : (1) Conversion Between Number Systems

The document outlines a practice programming assignment involving various data structures and algorithms. It includes: 1) Converting numbers between decimal, binary, octal, and hexadecimal number systems using functions with pointers. 2) Taking student data as input and sorting/displaying by name, enrollment number, and subject marks using arrays. 3) Creating a linked list to store integers, search/add values, and sort using various algorithms while comparing performance. 4) Designing a library management application and book transaction system using linked lists. 5) Creating sorted merged linked lists and calculating/modifying element sums.

Uploaded by

Ritik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment - 1

(17 July to 21th July)

(Practice Assignment)

(1) Conversion between number systems.

(a) Write a program for converting a given integer in decimal number system to its
binary equivalent. You should use a function that access values of an array using
pointers for reversal and pointer as an argument.

(b) Add another function to the above question to convert the integer to its octal number
system.

(c) Add an additional function to convert the integer to its hexadecimal number system.

(d) Modify all the above functions to convert a number having integer as well as decimal
part to its respective number system.

(e) Make a menu driven program to include all above conversions. Further extend them
to have their complementary functions too, i.e., decimal to binary & binary to
decimal; decimal to octal & octal to decimal; decimal to hexadecimal & hexadecimal
to decimal;

(f) Extend the program to have an option for conversion from decimal to any other
number system.

(2) Manipulation with arrays and strings, structures.

(i) Student Dataset

(a) Take input from user for „n‟ number of students. Store their names, enrolment
numbers and marks for 5 different subjects. („n‟ is a variable whose value is to be
input at runtime).

(b) Sort alphabetically on keyvalue name and display accordingly.

(c) Sort enrolment number wise and display accordingly.

(d) Sort marks wise for individual subjects and display accordingly.

(e) Make a menu-driven program for inclusion of all the above tasks from (i)(a) to (i)(d).

(ii) Take string as an input and convert it to its “Piglatin” form. Make a function for
depicting the rule and using it on the input given by the user.
Eg:
(3) Manipulation with a single Linked lists of integers.

(a) Create a linked list of numbers. Take input from user. Search and find the position of a
particular key value. If the key-value exists, return its position, else add it to the end of
the linked list.

(i) Sort the linked list in 3

(a) using (i) bubble sort, (ii) selection sort, (iii) quick sort,
(iv) merge sort, (v) insertion sort methods. Write functions for each of these.
Compare their performance in terms of number of comparisons and number of
swaps.

(ii) Delete a particular element, chosen by the user, from the above linked list.

(iii) Add an element, input by the user, at a position (i) mentioned by the user, (ii) at
the starting of the linked list, (ii) middle of the linked list, (iii) end of the linked
list.

(iv) Update the value of a particular element, chosen by the user, to another value.

(v) If there are multiple instances of the same number, delete it from all the positions,
except its (i) last position, (ii) first position, (iii) all the positions, where the
element was found.

(vi) Display the contents of SLL in reverse order.

(vii) Display identify second largest number in SLL (Do not sort the link list).

(b) Write a program to design a library management application using linked list which
will maintain a record of all the books available in the library including (Book name,
author, ISBN, publication year, no of copies available etc.). There is another list
containing the name of the issued books and the name of student, to whom the book is
issued. Provide menu which will contain options to add, delete, display and update
the entry in the records.

(c) Write a program to create another single link list (SLL1) having elements as 24, 6, 7,
8, 1, 2, 8, 10, 4, 27, 16, 26. Later, write a program to sort LL2 (retain all the duplicate
elements). Call this list as SLL2. Finally merge SLL2 with SLL1 such that elements
of merged linked list will be in sorted order (retaining all the duplicate elements).

(d) Write a program to find sum of all elements of linked list created in Q1 and Q2 above
separately. Write a function to perform following operations: If (sum of all elements
of first LL - sum of all elements of second LL) > last element of first LL then start
deleting last elements of first LL until (remaining elements of first LL - sum of all
elements of second LL) ≈ 0. Otherwise delete elements of first LL from beginning
until (remaining elements of first LL - sum of all elements of second LL) ≈ 0.

You might also like