We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Assignment No. 01
SEMESTER Spring 2020

CS502- Fundamentals of Algorithms

 

Total Marks: 20

 

Due Date: 28/05/2020

Instructions

Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit  if:

·         The assignment is submitted after due date.

·         The submitted assignment does not open or file corrupt.

·         The assignment is full or partially copied from (other student or ditto copy from handouts or internet).

·         Student ID is not mentioned in the assignment File or name of file is other than student ID.

·         The assignment is not submitted in .doc or .docx format.

Uploading instructions

Your submission must include:

 

·         Assignment should be in .doc or .docx format.

·         Save your assignment with your ID (e.g. bx180200786.doc).

Assignment submission through email is NOT acceptable

Objective

The objective of this assignment is

·         To give basic knowledge and understanding of Algorithms.

·         To be able to design simple algorithms.

·         To be able to understand and calculate the complexity of algorithms.

 

 

Note:

Your answer must follow the below given specifications.

·          Font style: “Times New Roman”

·          Font color: “Black”

·          Font size: “12”

·          Bold for heading only.

·          Font in Italic is not allowed at all.

·          No formatting or bullets are allowed to use.

·         Your answer should be precise and to the point, avoid irrelevant detail.

 

Lectures Covered: This assignment covers Lecture # 01 - 08

Deadline

Your assignment must be uploaded/submitted at or before 28/05/2020.

 

 

 

Assignment Statement:

 

Palindrome is a number which does not change even if we reverse its digits. For example, 121, 1331, 16561 etc, while 122, 2354, 25486 etc are not palindromes.

There may be many algorithms which can be written for the identification of a number to be palindrome or not palindrome.

 

Question No  01:   (Marks:  10)

You are required to design (write) a simple algorithm (Only Pseudo code) which can identify a number to be Palindrome or Not Palindrome.

 

Question No  02:   (Marks:  10)

You are required to calculate (Step by Step) the worst case time complexity T(n) of the algorithm designed in Question No. 01.

 

=====================================Ended=======================================

 

For any query about the assignment, contact at CS502@vu.edu.pk

 

GOOD LUCK

 

 

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 1232

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided. 

 

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

 

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

Click Here to Search (Looking For something at vustudents.ning.com?)

Click Here to Join (Our facebook study Group)

CS502_Assignment_No_01_Solution_Spring_2020

Download the file, Click on the below link

CS502_Assignment_No_01_Solution_Spring_2020

CS502 Assignment 1 Solution SPring 2020 

here its Detail about Your assignment but please don't try to copy and pasting system i'll provide you solution but you use it and customise it according to your needs Thanks 

#CS502assignment1solution2020
cs502 assignment 1 SOLUTION spring 2020 Correct solved Complete

CS502 Assignment 1 Complete Solution Spring 2020,CS502 Assignment 1 Complete Solution,CS502 Assignment 1,CS502,CS502 assignment 1 solution,CS502 assignment spring 2020,CS502 assignment solution spring 2020,CS502 assignment, assignment 1 CS502 solution, solution CS502 assignment 1, Cs502 assignment 1 solution 2020,Cs502 assignment solution 2020,Cs502 assignment 1,Cs502 assignment 1 solution spring 2020,Cs502 assignment no 1 solution spring 2020,Cs502 assignment no 1 solution 2020,Cs502 1st assignment solution 2020,Cs502 1st assignment solution,Cs502 1st assignment solution spring 2020,assignment solution spring 2020,CS502 Assignment 1 Complete Solution Spring 2020,CS502 Assignment 1 Complete Solution,CS502 Assignment 1,CS502,CS502 assignment 1 solution,CS502 assignment spring 2020,CS502 assignment solution spring 2020,CS502 assignment, assignment 1 CS502 solution, solution CS502 assignment 1 CS502 : Fundamentals of Algorithms
#CS502assignment1solution2020

CS502 Fundamentals of Algorithms Assignment 1 Solution & Dicussion Spring 2020


Solution Credit: @mc190203271

Question No 01:   (Marks:  10)

You are required to design (write) a simple algorithm (Only Pseudo code) which can identify a number to be Palindrome or Not Palindrome.

 

Solution:

int x;

reverse = 0:

while (x>0)

reverse = reverse + x % 10);

x / = 10;

if ( x = reverse )

then

           number is palindrome

  Else

          number is not palindrome

 

Question No  02:   (Marks:  10)

You are required to calculate (Step by Step) the worst case time complexity T(n) of the algorithm designed in Question No. 01.

 

Solution:

                                                                           frequency

int n;                                                                           1

reverse = 0;                                                                 1

while (n>0)                                                                  n

reverse = reverse + n % 10;                                         n

n / = 10;                                                                      n

if ( n = reverse)                                                            1

then                                                                             1

number is palindrome                                                    1

else                                                                              1

number is not palindrome                                               1

so time complexity of above algorithm would be as follows:

T(n) = 1+1+n+n+n+1+1+1+1+1

T(n) = n + 9

From the above equation the highest degree is n so its complexity is linear. This is the worst case time complexity of the above algorithm is T(n).

How sum of T(n) = 1+1+n+n+n+1+1+1+1+1 can be  n + 9?

Cs502 Assignment 1 Solution

link below 

Cs502 Assignment 1 Solution

#CS502 #CS502Assignment1Spring2020 #CS502_Assignment1
CS502 Assignment No 1 Solution Spring 2020 | Virtual University |

CS502 Assignment 1 Solution Spring 2020 Virtual University of Pakistan

Complete Guidance of Assignment CS502 Spring 2020

#CS502
#CS502Assignment1Spring2020
Cs502 assignment 1
cs502 assignment no 1 spring 2020
cs502 Fundamentals of Algorithms spring 2020
Virtual University of Pakistan
VU of Pakistan
VU.edu.pk

#CS502_Assignment1-Spring2020
#CS502Spring2020

Correct Solution For CS502 Assignment No.1 Spring 2020 uploaded by VU

Solution:

Question No. 01:  The algorithm for the identification of Palindrome number is as follows,

 

  1. PALINDROME (num)
  2. Define variables: orignum, reverse, remainder
  3. orignum = num
  4. while (num is not equal to 0)
  5.     remainder = num % 10    //  % operator calculate remainder.
  6.     reverse  = (reverse *10 ) + remainder
  7.     num = num /10
  8. if (reverse is equal to orignum)
  9. print “ number is palindrome”
  10. else
  11. print “ number is not palindrome”

 

 

 

Question No. 02: The step by stem analysis of the algorithm designed in question 1 is as follow,

 

The time taken by each statement (step) is given as follows,

 

Step 1:   C1                                      // Execute only 1 time or Constant Time or  O (1)

Step 2:   C2                                      // Execute only 1 time or Constant Time or  O (1)

Step 3:   C3                                      // Execute only 1 time or Constant Time or  O (1)

Step 4:   [log(num)/log(10)] +1        // Execute [log(num)/log(10)] +1 times

Step 5:   [log(num)/log(10)] +1        // Execute [log(num)/log(10)] +1 times

Step 6:   [log(num)/log(10)] +1        // Execute [log(num)/log(10)] +1 times

Step 7:   [log(num)/log(10)] +1        // Execute [log(num)/log(10)] +1 times

Step 8:    C4                                                  // Execute only 1 time or Constant Time or  O (1)

Step 9:    C5                                                          // Execute only 1 time or Constant Time or  O (1)

Step 10:  C6                                                          // Execute only 1 time or Constant Time or  O (1)

Step 11:  C7                                                  // Execute only 1 time or Constant Time or  O (1)

 

Total time T(n) can be calculated as follows,

 

             T(n)    = C1 + C2 + C3 + [log(num)/log(10)] +1  +[log(num)/log(10)] +1 +[log(num)/log(10)]                

                             1 + [log(num)/log(10)] +1  + C4 + C5 + C6 + C7

           T(n)    = C1 + C2 + C3 + C4 + C5 + C6 + C7+ 4+ 4[log(num)/log(10)]

           T(n)    = C8 + 4[log(num)/log(10)]         //  C8  = (C1 + C2   + C3 + C4 + C5 + C6 + C7 +4)

           T(n)    =  log(num) / log(10)                  //   Ignoring constant terms

           T(n)    =  log(n) / log(10)                                 //   If   num = n  ( or replace num with n)

          

Or      T(n)   =  O (log (n) / log (10)        

RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.