3.1 Data structures - Stack
Assignment 3.1.1: Application of Stack Data Structure
Objective: To understand how to apply Stack Data Structure.
Problem Description: Write a pseudo code to find the binary value of a given integer and
display it.
Hint: Consider the integer 5. To convert 5 to binary, the following procedure needs to be
adopted.
2|_5____
2|_2_-_1_
_1__- 0_
Each time, store the remainder in an appropriate data structure and use LIFO to get the
binary value.
No comments:
Post a Comment