Monday, 11 March 2019

PARALLEL COMPUTING



B.Tech.: Branch Name: CSE        Subject: Parallel Computing

a.    What do you mean by parallel sorting algorithm?
b.   Discuss enumeration sorting algorithm.
c.    Explain Parallel quick sorting algorithm.
d.   Describe parallel matrix multiplication algorithm.
e.   Illustrate UMA Multiprocessor to solve linear equations.
f.     Explain First Depth and Breadth First Search algorithm for graph.
g.    Solve for Bitonic sort for the series C N M F H A P D. also write algorithm.
h.   Sort the elements using Hyper Quick Sort: 11 50 53 95 36 44 67 86 1 16 35 81 5 15 23 44 15 46 48 93 39 6 72 91 14 36 69 40 89 61 97 12 21 54 (32 elements).
i.       Develop the algorithm for implementation of the Shell sort.     
j.     What is Granularity? Explain effect of granularity on parallel processing.
k.    Write algorithm for Odd-Even problem also solve A, C, B, E, D, H, F, G using Odd-Even.
l.      What is speedup? Differentiate Ideal speedup v/s True speedup.
m. Compare shared memory v/s Dynamic memory programming model.
n.   Differentiate ideal speedup v/s true speedup.
o.   What is the essence of the parallel generalization of the basic sorting operation?

                                                                      



Parallel Computing (TCS-081) Unit 1 Important Questions Uttarakhand Technical University  


Monday, 19 November 2018

Linked List: Data Structure


Linked List: Data Structure

Access our official website:

http://examworld.co.in/data-structure-questions-and-answers-assignment-3/



Q.1. Write an algorithm to find the location of an element in the given Linked List. Is the binary search will be suitable for this search? Explain the reason.

Sol. As Linked List does not have sequence of element in linear format so one will have to Generate a  while loop by traversing all nodes comparing the data with K which is the element to search in Linked Link.

Algorithm SEARCH_Node_Linked List (K, Head) // Name of the Function

Begin t=0                       // Variable initialize which will be updated only when K is found

current =head               // Initially pointer points to head of the Linked List

while (current !=null)   //Till end of LL

{

 if(current ->info=K       // Data of the node

 { t=1 break }

current=current->next

}

if(t=1)

print ”Element found”

else

print “Not found" End.   //End of the Algorithm



Use of binary Search in Linked List: it is worthless to use Binary Search in LL in order to find element as time complexity will be O(n), because it is tedious task to find out the middle node of any LL which is pre-requisiteness of Binary Search.



Q.2. Write down an algorithm to delete a node from doubly Linked List.



Sol. Following is the representation of doubly Linked List consisting the header, Next Node, Previous Node address in front and rear part of each node.



Image Courtesy: https://www.geeksforgeeks.org/delete-a-node-in-a-doubly-linked-list/



Algorithm to delete node from any position

%% Input : head {Pointer to the first node of the list}

         last {Pointer to the last node of the list}

         N {Position to be deleted from list}

Begin:

    current ← head;

    For i ← 1 to N and current != NULL do

        current ← current.next;

    End for

    If (N == 1) then

        deleteFromBeginning()

    End if

    Else if (current == last) then

        deleteFromEnd()

    End if

    Else if (current != NULL) then

        current.prev.next ← current.next

        If (current.next != NULL) then

            current.next.prev ← current.prev;

        End if

        unalloc (current)

        write ('Node deleted successfully from ', N, ' position')

    End if

    Else then

        write ('Invalid position')

    End if

End



In the above algorithm, if node to be deleted is first node then delete first node algorithm will be invoked, in case last node pointer last node will be deleted, now for the any node:



current.prev.next ← current.next

        If (current.next != NULL) then

            current.next.prev ← current.prev;

Address of next node of current will be stored in previous node, in next step; address of previous node will be assign in next node of current node.



Q.3. Write down the algorithm to find out the middle node in singly linked list.

Sol.  There are two methods to solve this question:

Method A: Blind Fold Method



Traverse the entire linked list and count the total number of nodes. Now traverse the list again till count/2 and return the node at count/2. This is very naïve and foolish idea to find the middle node.



Algorithm for Method A:

Middle_Node_Linked List (Count, Head) // Name of the Function

Begin t=0, Count=0;                       // Variable initialize to find total nodes in LL

current =head               // Initially pointer points to head of the Linked List

while (current !=null)   //Till end of LL

{

Count++// Data of the node

current=current->next

}

If(current==Null)

Return No node    //No Node is there in LL

If(current==Head)

Return Head     //first Node is middle node

Else

For i ← 1 to Count/2 and current != NULL do

        current ← current.next;

End for

//End of the Algorithm





Method B: Two concurrent pointers methods



Traverse linked list using pointer “a” and pointer “b”. Move pointer “a” by one and pointer “b” by two. When the pointer “a” reaches end slow pointer will reach middle of the linked list. Therefore we will find the middle node.



Algorithm for Method B:





Node *slow_ptr = head;

Node *fast_ptr = head;



    if (head!=NULL)

    {

        while (fast_ptr != NULL && fast_ptr->next != NULL)

        {

            fast_ptr = fast_ptr->next->next;

            slow_ptr = slow_ptr->next;

        }

        printf("The middle element is [%d]\n\n", slow_ptr->data);

    }



Support Video: https://www.youtube.com/watch?v=Uk-PkL5WMMY



Q.4. Write down the algorithm to add two linked lists. For example node1=561 and node2=246 then output should be num=807

Sol.

Steps to be taken place in order to write algorithm:



Step 1: Count the size of both Linked Lists.

Step 2: if size is same then perform the addition else find out the difference of both LLs.

Step 3: take care of Carry if there is while adding nodes value and add this carry in next nodes addition     as per basic Decimal Addition rule.

Step 4: Put the values in separate Stacks in then add these values.

Step 5: output the final addition of two LLs.



Algorithm:

----------------------------------------------------------------------------------------------------------------

Node* addUsingReverse(Node*h1, Node*h2)

{

    reverseLL(&h1);

    reverseLL(&h2);

    Node*a = h1;

    Node*b = h2;

    int carry = 0;

    Node* c = NULL;

    while(a != NULL || b!= NULL)

    {

        int sum = carry;

        if(a != NULL)

            sum += a->data;

        if(b != NULL)

            sum += b->data;

        carry = sum / 10;

        sum = sum % 10;

        appendNode(&c, sum);

        if(a != NULL)

            a = a->link;

        if(b != NULL)

            b = b->link;

    }

    if(carry != 0)

        appendNode(&c, carry);

    reverseLL(&h1);

    reverseLL(&h2);

    reverseLL(&c);

    return c;

}

------------------------------------------------------------------------------------------------------------

Courtesy by: http://www.ritambhara.in/add-numbers-given-in-the-form-of-linked-list/



Q.5. Write down the algorithm to Sort the elements of doubly Linked List.

Sol.  For the sorting of elements in LL we can initialize the temp1 and tem2 variable and also third variable T.

Algorithm Sort_Doubly_Linked_List ()                         // Name of the Function

Begin temp1=head                                                  // initialize from header node
Repeat 3 and 4 till while (temp1 !=null)             // Initially pointer points to head of the Linked List
If(temp1->info > temp2->info)                           //compare the values of nodes
do (i), (ii), (iii) and (iv)

                        T=temp1->info                          //swapping the values of temp1 and temp2
                      temp1->info > temp2->info
                                                                    iii.            temp2->info > T

                    temp2=temp2-> next;
temp1=temp1->next;
//End of the Algorithm






******* Best of Luck *********



WITH REGARDS
SACHIN KUMAR SAXENA
With you, In Christ, In His Mission
Assistant Professor, CSE DEPARTMENT,

College of Engineering Roorkee, Roorkee,

Uttarakhand

+91-8909603708

Saturday, 9 June 2018

UGC NET COMPUTER SCIENCE SAMPLE PAPERS WITH SOLUTIONS


To check your score attempt the following sample papers:

Access our new website:

www.examworld.co.in 



  1. UGC NET COMPUTER SCIENCE PAPER 2: SUB-COMP. NETWORK     SET 1
  2. UGC NET COMPUTER SCIENCE PAPER 2: SUB-DATA STRUCTURE    SET 2
  3. UGC NET COMPUTER SCIENCE PAPER 1: TOPIC: DAYS SPECIAL      SET 3
  4. UGC NET COMPUTER SCIENCE PAPER 1: TOPIC: MISC.                       SET 4
  5. UGC NET COMPUTER SCIENCE PAPER 1: TOPIC: MISC.                       SET 5

Saturday, 17 October 2015

Design and Analysis of Algorithm PPL CRYPTOGRAPHY NOTES

To Download Study Material click on appropriate link :-

Unit 1

Unit 2

Tutorial on Unit 2

Unit 3

Unit 4

Unit 5

References

  1. Complete Book for DAA
  2.  Advance DAA Book 2
  3. Advance DAA Book 
  4.  Coreman solution
  5. Coreman solution 2
  6. DAA Notes full
  7. Previous Paper with Solution
  8. Design and Analysis of Algorithm AKTU Sample Paper 1
  9. Design and Analysis of Algorithm AKTU Sample Paper 2

Previous Year Question Papers




Assignments
  1. Assignment 1
  2. Assignment 2
  3. Assignment 3
  4. Assignment 4
  5. Assignment 5
Tutorials


  1. Tutorial 1
  2. Tutorial 2
  3. Tutorial 3
  4. Tutorial 4
  5. Tutorial 5
Quizes
  1. Quiz 1
  2. Quiz 2
  3. Quiz 3
  4. Quiz 4
  5. Quiz 5

Friday, 8 February 2013

DATA STRUCTURE C++ LECTURE NOTES

To Download Data Structure Study Material click on appropriate link :-


Subject Name: Data Structure                                                          
------------------------------------------------------------------------------------------------------------------
Subject Code: KCS301                                                           Syllabus: Click Here
------------------------------------------------------------------------------------------------------------------
Course File: Data Structure Theory Handbook
------------------------------------------------------------------------------------------------------------------
Course File: Data Structure Lab Handbook
------------------------------------------------------------------------------------------------------------------
University Name: Dr. APJ Abdul Kalam Technical University (AKTU, Lucknow)
-------------------------------------------------------------------------------------------------------------------
College Name: Shri Ram Murti Smarak College Of Engineering, Technology & Research                                    Bareilly
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Facebook Link: https://www.facebook.com/sachin36500081








 Assignment 2         Excel Sheet        Submission
 Unit I notes
 Data Structure Lab Programs
                                 Lab Programs 1
                                 Lab Programs 2
                                 Lab Programs 3
                                 Lab Programs 4
                                 Lab Programs 5
                                 Lab Programs 6
                                 Lab Programs 7


16. Tree Graph Algorithm             Part 1        Part 2
                                                        PDF Doc     PDF  Doc


15. Unit 5 Notes       PDF    PPT

14. Unit 4 Notes       PDF    PPT


13. Unit 3 Notes       PDF    PPT 

12. Tutorial 3 Last Submission Date Mar 15, 2013

11. C++ software:- 32-bits and 64 bits (both) for Windows 8 Free Download


10. C++ Programming Basics Book: To Download Click Here  


9. Tutorial Sheet 2 Last Submission Date: Mon, Mar 04, 2013 

8. Lecture Notes Unit I and Unit II ..... (Part I)


7. Head First "C" Book PDF Free Download


6. Lab Programs


5. Tutorial 1 Last submitting date - Feb 20, 2013


4. Lab Manual First Page


3. Data Structure Previous Year UTU Question Papers


2. Coreman Book Free Download


1. Syllabus Data structure Using C++


Hitwebcounter.com Code






GATE Notes

Intro to Soft Computing Objective Questions

  Question Statement         Solution with step wise marking "Select a 4-input neuron weighs 1, 2, 3, 4. The transfer function here...