Assignment Fundamental of Data Structure, Study notes of Computer Fundamentals

Assignment 1 In this file FDS code Is available it is useful for Savitribai Phule pune university student which they come from Computer Science and Design Engineering Computer Engineering and Artificial intelligence and Data Science And information engineering Technology engineering students using this code you can understand that the assignment it will be very useful for those who came from computer Second year engineering and whose university is Savitribai Phule Pune University ..............

Typology: Study notes

2021/2022

Uploaded on 12/11/2022

dikshaahire
dikshaahire 🇮🇳

2 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Assignment Number: 1
Problem statement:
Write a Python program to store marks scored in subject “Fundamental of
Data Structure” by N students in the class. Write functions to compute
following:
a) The average score of class
b) Highest score and lowest score of class
c) Count of students who were absent for the test
d) Display mark with highest frequency
Objective:
Understand the use of Array as linear data structure
Theory:
Linear Data structure
Adatastructureis said to belinearif its elements form a
sequence or alinearlist.
Examples:
1. Array
2. Linked List
3. Stacks
4. Queues
Definition of Array:
An array is a collection of data that holds fixed number of values of
same data type.
Declaration of array:
C/C++: data_type array_name[array_size];
For example: if you want to store marks of 100 students, you can
create an array as
float marks[100];
suppose you declared an arraymarkas above. The first element
ismark[0], second element ismark[1]and last element is
mark[99].
Graphical representation of array:
Python
Create an array containing car names:
cars = ["Ford","Volvo","BMW"]
pf3

Partial preview of the text

Download Assignment Fundamental of Data Structure and more Study notes Computer Fundamentals in PDF only on Docsity!

Assignment Number: 1 Problem statement: Write a Python program to store marks scored in subject “Fundamental of Data Structure” by N students in the class. Write functions to compute following: a) The average score of class b) Highest score and lowest score of class c) Count of students who were absent for the test d) Display mark with highest frequency Objective: Understand the use of Array as linear data structure Theory: Linear Data structure A data structure is said to be linear if its elements form a sequence or a linear list. Examples:

  1. Array
  2. Linked List
  3. Stacks
  4. Queues Definition of Array: An array is a collection of data that holds fixed number of values of same data type. Declaration of array: C/C++: data_type array_name[array_size]; For example: if you want to store marks of 100 students, you can create an array as float marks[100]; suppose you declared an array mark as above. The first element is mark[0], second element is mark[1] and last element is mark[99]. Graphical representation of array: Python Create an array containing car names: cars = ["Ford", "Volvo", "BMW"]

Advantages of array:

  1. Easier to use and access
  2. Faster access to the element
  3. Array permit efficient random access
  4. Arrays are most appropriate for storing a fixed amount of data
  5. Arrays are most compact data structures
  6. Well known application such as searching ,hash table, matrix operation and sorting Disadvantages of array:
  7. Fixed size - the size of the array is static
  8. Insertion and deletion at any location is difficult Algorithm: For finding average marks: Input: Array of size n Output: Average marks of student Step 1: Start Step 2: Read number of students in n Step 3: Read marks of n students in array marks Step 4: Initialize sum =0 and i= Step 5: if (i >= n ) go to 9 Step 6: sum =sum + marks[i] Step 7: i=i+ Step 8: go to 5 Step 9: average=sum/n Step 6: Display average Step 7: Stop Time Complexity:
  1. Calculating Average is ___________________
  2. Finding maximum of an array is _____________________ Test cases
  1. n=30 (array size is 20)
  2. n= 10 20 -1 18 -1 -
  3. n= -1 20 -1 18 -1 15