Ministry of Food
Post: Sub-Assistant Engineer
Exam Date: 09/02/2021, Exam Taker: BPSC
Linear Search Algorithm
Linear Search is a simple searching algorithm where each element of the list or array is checked one by one sequentially until the desired element is found or the list ends. It does not require the data to be sorted.Best Case
The best case occurs when the target element is found at the first position of the list.
Time Complexity: O(1)
Worst Case
The worst case occurs when the target element is found at the last position or is not present in the list at all.
Time Complexity: O(n)
Average Case
On average, the element is found somewhere in the middle of the list.
Time Complexity: O(n)
Summary
Best Case: O(1)
Worst Case: O(n)
Average Case: O(n)
Linear Search Algorithm কী?
Linear Search হলো একটি সহজ searching algorithm যেখানে list বা array এর প্রতিটি element ক্রম অনুযায়ী একে একে পরীক্ষা করা হয় যতক্ষণ না কাঙ্ক্ষিত element পাওয়া যায় বা list শেষ হয়ে যায়। এতে data sorted হওয়া প্রয়োজন হয় না।
Best Case
Best case ঘটে যখন খোঁজা element টি list এর প্রথম অবস্থানেই পাওয়া যায়।
Time Complexity: O(1)
Worst Case
Worst case ঘটে যখন খোঁজা element টি শেষে থাকে অথবা list এ একেবারেই না থাকে।
Time Complexity: O(n)
Average Case
Average case এ element সাধারণত list এর মাঝামাঝি অবস্থানে পাওয়া যায়।
Time Complexity: O(n)
সারসংক্ষেপ
Best Case: O(1)
Worst Case: O(n)
Average Case: O(n)
Stack Operations
A Stack is a linear data structure that follows the LIFO (Last In First Out) principle. The main operations of a stack are described below:
1) Push
Push operation is used to insert an element at the top of the stack. If the stack is full, it causes overflow.
2) Pop
Pop operation is used to remove the top element from the stack. If the stack is empty, it causes underflow.
3) Peek / Top
Peek operation returns the top element of the stack without removing it.
4) IsEmpty
This operation checks whether the stack is empty or not.
5) IsFull
This operation checks whether the stack is full or not.
Stack এর Operations
Stack হলো একটি linear data structure যা LIFO (Last In First Out) নীতিতে কাজ করে। Stack এর প্রধান operation গুলো নিচে সংক্ষেপে বর্ণনা করা হলো:
১) Push
Push operation ব্যবহার করা হয় stack এর top এ নতুন element যোগ করার জন্য। Stack পূর্ণ থাকলে একে overflow বলা হয়।
২) Pop
Pop operation ব্যবহার করা হয় stack এর top element সরানোর জন্য। Stack খালি থাকলে একে underflow বলা হয়।
৩) Peek / Top
Peek operation stack এর top element দেখায় কিন্তু সেটি remove করে না।
৪) IsEmpty
এই operation পরীক্ষা করে stack খালি কিনা।
৫) IsFull
এই operation পরীক্ষা করে stack পূর্ণ কিনা।
1) Set, Power Set, Proper Subset
Set: A set is a well-defined collection of distinct objects (elements).
Example: A = {1, 2, 3}
Power Set: The power set of A, written P(A), is the set of all subsets of A.
Example: If A = {1,2}, then P(A) = {∅, {1}, {2}, {1,2}}
Proper Subset: A is a proper subset of B (A ⊂ B) if every element of A is in B and A ≠ B.
Example: {1,2} ⊂ {1,2,3}
2) Membership Table Proof
Prove: overline{A ∪ (B ∩ C)} = (C’ ∪ B’) ∩ A’
Conclusion: The column overline{A∪(B∩C)} and the column (C’∪B’)∩A’ are identical for all 8 cases. Hence, the identity is proved.
1) Set, Power set, Proper subset
Set: Set হলো কিছু নির্দিষ্ট (well-defined) আলাদা আলাদা element-এর collection।
Example: A = {1, 2, 3}
Power set: কোনো set A-এর power set P(A) হলো A-এর সব subset-এর set।
Example: A = {1,2} হলে P(A) = {∅, {1}, {2}, {1,2}}
Proper subset: A হলো B-এর proper subset (A ⊂ B) যদি A-এর সব element B-তে থাকে এবং A ≠ B হয়।
Example: {1,2} ⊂ {1,2,3}
2) Membership table দিয়ে প্রমাণ
প্রমাণ কর: overline{A ∪ (B ∩ C)} = (C’ ∪ B’) ∩ A’
Conclusion: সব ৮টি case-এ overline{A∪(B∩C)} কলাম এবং (C’∪B’)∩A’ কলাম একদম একই। তাই identity প্রমাণিত।
Given:
A − B = {1, 5, 7, 8}
B − A = {2, 10}
A ∩ B = {3, 6, 9}
Concept Used
A set can be reconstructed using:
A = (A − B) ∪ (A ∩ B)
B = (B − A) ∪ (A ∩ B)
Finding Set A
A = {1, 5, 7, 8} ∪ {3, 6, 9}
A = {1, 3, 5, 6, 7, 8, 9}
Finding Set B
B = {2, 10} ∪ {3, 6, 9}
B = {2, 3, 6, 9, 10}
Final Answer
A = {1, 3, 5, 6, 7, 8, 9}
B = {2, 3, 6, 9, 10}
Combinational Circuit
A combinational circuit is a digital circuit whose output depends only on the present input. It does not have memory elements.
• No memory
• Output changes immediately with input
• No feedback path
• Examples: Adder, Subtractor, Multiplexer, Decoder
Sequential Circuit
A sequential circuit is a digital circuit whose output depends on both present input and past output (state). It uses memory elements like flip-flops.
• Has memory
• Output depends on previous state
• Feedback path exists
• Examples: Counter, Register, Shift RegisterKey Differences
• Combinational: Output depends only on input
• Sequential: Output depends on input + memory
Combinational এবং Sequential Circuit এর মধ্যে পার্থক্য
Combinational Circuit
Combinational circuit হলো এমন একটি digital circuit যেখানে output শুধুমাত্র বর্তমান input এর উপর নির্ভর করে। এতে কোনো memory থাকে না।
• Memory নেই
• Input পরিবর্তন হলে output সাথে সাথে পরিবর্তিত হয়
• Feedback path নেই
• উদাহরণ: Adder, Subtractor, Multiplexer, Decoder
mc
39Sequential Circuit
Sequential circuit হলো এমন একটি digital circuit যেখানে output বর্তমান input এবং পূর্ববর্তী output (state) এর উপর নির্ভর করে। এতে flip-flop এর মতো memory element থাকে।
• Memory আছে
• Output পূর্বের state এর উপর নির্ভরশীল
• Feedback path থাকে
• উদাহরণ: Counter, Register, Shift Register
মূল পার্থক্য
• Combinational circuit এ output শুধু input এর উপর নির্ভর করে
• Sequential circuit এ output input এবং memory দুটোর উপর নির্ভর করে
Diagram of Combinational and sequential circuit:
A’B’C’ + B’CD’ +A’BCD’+ AB’C’
=A’B’C’D’+A’B’C’D+A’B’CD’+AB’CD’++A’BCD’+AB’C’D’+AB’C’D
MINTERM(0,1,2,6,8,9,10)

