Data Structure: Linked List- Part 3

Aug 17, 2016

INSERTION A NEW NODE INTO A HEADER LINKED LIST
সমস্যাঃ একটি নতুন node linked list এর একটি node (যার data মান x) ও তার পরবর্তি (successor) node এর মাঝে insert (যুক্ত) করতে হবে। 

সমাধান: প্রথমে আমাকে linked list এর x মান বিশিষ্ট node টি খুঁজে বের করতে হবে। ধরি, LOC pointer টি নির্দিষ্ট node কে point করে আছে। x মান বিশিষ্ট node যদি linked list এ না থাকে তাহলে তা linked list এর শেষে যুক্ত হবে অর্থাৎ LOC pointer শেষ node কে point করে থাকবে। কিছু শর্ত নিয়ে এখন আলোচনা করব। 

Data Structure: Linked List- Part 2

Aug 16, 2016


INSERT A NEW NODE INTO A HEADER LINKED LIST

Problem-I: Insert a new node between a node which data field is x and its predecessor. If x is not found in header linked list then, the new node insert at the end of the list.

Solution: The first objective is to find the location of the node which data field is x. Let LOC be the pointer to point the target node and LOCP be the pointer that point the predecessor of the target node. If there is not exist any node which data field is x, then we set LOC←NULL and LOCP point to the last node of the linked list . If the target node is header node then we set LOCP←NULL and LOC←head.

Data Structure: Linked List - Part 1

Aug 15, 2016

Basic
Data Structure এর সবচেয়ে গুরুত্বপূর্ন বিষয় হচ্ছে linked list. এটা C প্রোগ্রাম শেখার পর নতুন একটা অধ্যায়। এটা খুব ভালোভাবে রপ্ত করতে পারা, প্রথামিক অবস্থায় সামান্য কঠিন আছে। যেহেতু আমাদের C প্রোগ্রামের structure সম্পর্কে ধারনা আছে তাই, একটা Node কি তা structure দিয়ে বললে অনেকের কাছে সহজ হবে। আমরা parallel কিছু array দিয়েও Linked list ব্যাখা করতে পারি, তবে তা পরে আলোচনা করা যাবে। C তে integer type variable কে point করার জন্য ওই ধরনের একটা pointer লাগে। একইভাবে structure type variable কে point করার জন্য ওই ধরনের একটা pointer লাগবে।
 

LightOJ 1098 - A New Function

Dec 3, 2015

Problems: LightOJ 1098 - A New Function
Explain:
The function  SOD(n)  (sum of divisors) is defined as the summation of all the actual divisors of an integer number n.The function CSOD(n) (cumulative SOD) of an integer n, is defined as below:

 

Number System - Covert a Decimal Number to Octal and Hex Number

Oct 23, 2015

It is  very interesting topic. If we simple think, the process of conversion from decimal number to Octal number, then we can follow the below steps:
1. Let x = 15
2. r[0] = x%8 = 7
3. x = x/8 = 1
4. r[1] = x%8 = 1;
5. x = x/8 = 0
Terminate the algorithm, we find (15)10 = (17)8 [Note: reverse r]
But if we use bit-wise operator, then it makes more interesting and efficient.