Explain the sorting techniques selection sort

Assignment Help Data Structure & Algorithms
Reference no: EM133648

QUESTION 1

You are required to provide suitable examples of your own for each part of the question where appropriate

(a)(i) Define a structure?

(ii) What is a structure member?

(iii) How can structure variables be declared?

(iv) How can the members of a structure variable be assigned initial values?

(v) How can the size of a structure be determined?

(b)(i) What is a union?

(ii) How does a union differ from a structure?

(iii) How is a union member accessed?

(iv) How can a member of a union variable be assigned an initial value?

(v) Explain the rules which apply when processing unions

(c) Write down a structure which contains the following four members-

(i) an integer quantity called student_id

(ii) a 40-element character array called student_name

(iii) an integer quantity called phone_number

(iv) a floating-point quantity called marks

Include the user defined data type 'student' within the definition

QUESTION 2

(a)(i) What is the primary advantage when using data files in programs?

(ii) Describe how data files can be categorized in C

(iii) What is the purpose of a buffer area when working with data files?

(iv) Explain how the buffer area is defined?

(b)(i) What is a stream pointer?

(ii) What is the relationship between a stream pointer and a buffer area?

(iii) Explain the process of opening a data file in C

(c) Read the sample C program given below and answer the questions based on it

#include <stdio.h>

main( ){

FILE *opt1, *opt2; char student_name[30];

opt1 = fopen("list.old", "r");

opt2 = fopen("list.new", "w")

......................

fclose(opt1);

fclose(opt2);

}

Write down appropriate statements to perform the following tasks-

(i) Read the string represented by student_name from the file list.old

(ii) Display the result on the screen

(iii) Enter an updated string

(iv) Write the new string to the data file list.new

QUESTION 3

(a) Give two advantages of using 'Linked List' instead of 'arrays' in programs

(b) Write down the definition of a 'linked list' to contain the following-

(i) course_id of datatype integer

(ii) character array course_name of size 40

(iii) floating-point variables duration and fees

(iv) pointer variable next of the same structure type

(v) Include the tag course within the definition

(c)(i) Declare two variables of type course

(ii) Write down appropriate statement(s) to allocate memory to the first node

(d) Write down the function to create the linked list with the nodes declared. This function must also allow the user to terminate the input

QUESTION 4

(a) Explain the following sorting techniques using appropriate algorithms-

(i) selection sort

(ii) bubble sort

(b) Explain how 'linear search' differs from 'binary search' using suitable algorithms

Reference no: EM133648

Questions Cloud

What is an angular speed about the center of mass : What is an angular speed about the center of mass
Evaluate net present value of this investment opportunity : Evaluate the net present value of this investment opportunity. Determine the internal rate of return of this investment opportunity.
Explain the spacing between allowed vibrational energy level : Explain the spacing between allowed vibrational energy levels
Prepare journal entries for mcdaniel : Prepare journal entries on 1/1/2015 for McDaniel Prepare journal entries on 12/31/2015 for McDaniel
Explain the sorting techniques selection sort : Explain the following sorting techniques using appropriate algorithms- (i) selection sort (ii) bubble sort
How long can craft hover over the moon surface : How long can craft hover over the moon surface Contract between Einstein's calculations and observed precession
What are the corresponding velocity vectors : What are the corresponding velocity vectors
Explain the fifo structure of the queue : Explain the FIFO structure of the queue Explain how you would implement the queue data structure in its simplest form. Illustrate your answer fully with the necessary sample code
Find out the minimum sound intensity : Find out  the minimum sound intensity

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  C++ program to evaluate expressions combining set union

Create a C++ program to evaluate expressions combining set union, set intersection and parentheses

  Determine the branching factor

Expalin the search algorithm that results from each of the following special cases. How does it relate to other algorithms we have discussed.

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Survey of fault tolerance policy for load balancing scheme o

This paper investigates about fault-tolerance in load balancing schemes in distributed environment. There are some more parameters influencing QOS but our main focus is on fault tolerance and load balancing.

  Explain the fifo structure of the queue

Explain the FIFO structure of the queue Explain how you would implement the queue data structure in its simplest form. Illustrate your answer fully with the necessary sample code

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Different applications of data structure

What are the different applications of Data Structure

  Data structures for a single algorithm

Data structures for a single algorithm

  Determine the inorder, preorder and postorder traversal

Determine the Inorder, preorder and postorder traversal

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Describe sorting algorithms and how they work

Describe sorting algorithms and how they work

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd