Thursday, August 4, 2011

In-Place and O(n) Algorithm for finding Palindrome in a SLL

struct list_node *pal; //GLOBAL VAR

void PalindromeCheck(struct list_node *node)
{
static int i=1;
static int mid;

i++;
if ( node->next == NULL )
{
pal=head->start;
if (node->data!=pal->data){
printf("\nNot Palindrome\n");
exit(0);
}
else {
i--;
}
mid=i/2;
return;
}
PalindromeCheck(node->next);
pal=pal->next;
i--;
if ((i >= mid) && (node->data!=pal->data)) {
printf("\nNot Palindrome\n");
exit(0);
}

if (i < mid) {
printf("\nPalindrome\n");
exit(0);
}
}

Tuesday, July 5, 2011

Block Read Performance improvement in __bread()

My Code Changes in __bread function so that we should check the block block number and size limit before looking for the buffer into the Per-CPU cache list and Radix Tree Page Cache in __find_get_block_slow function.

bash-3.2$ diff -u buffer_backup.c fs/buffer.c
--- buffer_backup.c 2011-07-05 13:01:28.950511000 +0530
+++ fs/buffer.c 2011-07-05 13:03:02.339457000 +0530
@@ -1084,18 +1084,6 @@
static struct buffer_head *
__getblk_slow(struct block_device *bdev, sector_t block, int size)
{
- /* Size must be multiple of hard sectorsize */
- if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
- (size < 512 || size > PAGE_SIZE))) {
- printk(KERN_ERR "getblk(): invalid block size %d requested\n",
- size);
- printk(KERN_ERR "logical block size: %d\n",
- bdev_logical_block_size(bdev));
-
- dump_stack();
- return NULL;
- }
-
for (;;) {
struct buffer_head * bh;
int ret;
@@ -1411,7 +1399,21 @@
struct buffer_head *
__bread(struct block_device *bdev, sector_t block, unsigned size)
{
- struct buffer_head *bh = __getblk(bdev, block, size);
+ struct buffer_head *bh;
+
+ /* Size must be multiple of hard sectorsize */
+ if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
+ (size < 512 || size > PAGE_SIZE))) {
+ printk(KERN_ERR "getblk(): invalid block size %d requested\n",
+ size);
+ printk(KERN_ERR "logical block size: %d\n",
+ bdev_logical_block_size(bdev));
+
+ dump_stack();
+ return NULL;
+ }
+
+ bh = __getblk(bdev, block, size);

if (likely(bh) && !buffer_uptodate(bh))
bh = __bread_slow(bh);

Monday, January 17, 2011

Technology to Punish the Guilty

Past weekend I saw the movie "No one killed Jessica", although I knew most of the case history through newspaper feeds and through "Breaking News" no news channels but never got such a real shocker as I got when I saw the movie, after watching the movie I really got the feel of what the family of late Jessica Lal went through while seeking for the justice for her. In spite of aware of the fact that criminal cases usually takes years to come to a conclusion, which is wrong most of the times, I was really sad to see that I took almost 10 years for our judiciary and police to finally nail the culprit.
I think its really a high time in our country to improve the criminal justice system and hence I thought about why not using technology to improve this, no I am not talking about making court records online or online FIR etc., but I am talking about including technology in weapon's itself. What I mean to say that why can't we have a chip in each and every gun/revolver or any such weapon which will have a micro-chip and which needs to be registered with national central server and also linked with the weapon license number, so whenever a person fires the gun the chip will get activated and connected to central server and log some of the data which mentions the lattitude and longitude of site where the gun is fired and the time and other gun details. This I think will then prove to be a very important record for courts to easily prove the person gulty of crime. I know in India people always finds a trick or way to bypass the technological glitches to commit crime but still I think this can be step forward to improve the criminal system in India.

Thursday, June 5, 2008

Someone seems to be Hacking my mind

In my previous blog as I mentioned an idea to improve education system in India similarly an idea came to my mind which although having a different business model but same crux of uplifting BOP population.
Long time back I read somewhere about Virgin Atlantic's business model for there customer support operations, Virgin Atlantic had very brilliant idea, to have customer support executives as house wives or females sitting at home because of there some personal constraint and cant go out to work, which they materialized also, so the company recruited such females to provide there customer support by sitting at home, this model had reduced company's operation cost by huge margins and there OPM shooted.
So based upon Virgin atlantics operations i thought that why not we in India can have customer support operations running from rural areas since the only thing people in rural india lack is there English communication, so lets say some US company wants to have there BPO in india just for documentation purposes or any company which doesn't require some sort of specialized degree for there customer support operations can open there operations in rural areas where they can train youngsters and get them to work at much lower cost then to there employees in urban india. This way company can reduce there operation costs by huge margins with same quality of customer support. Although the major stumbling bloc is time required to train people in rural areas will definetly be much greater then that in urban areas but still in long run it will become a much efficient way to provide customer support.
So now you must be scratching your mind that why I have given a title "Someone seems to be Hacking my mind" to this blog. There are two reasons for this, first is related to my previous blog because the couple days after this idea of making educations systems listed on stock exchange came to my mind Mumbai University annouced that they thinking to making it listed on stock exchange, second reason is related to idea i proposed in previous paragraph since this idea bubbled in my mind around three or four months back and just two days back i read in Business Line that an insurance company has opened its Back office operations in a remote village in Andhra Pradesh. This village which used to be under the gripping of naxalites now seems to be under the gripping rural yuppies who are earning handsome moolah. So considering this i think that some is hacking my getting and making moolah but the important thing is corporates pondering over an idea of "Fortune at Bottom of Pyramid" and making lives of crores of people, who's life is in shambles, happier then ever.

Wednesday, January 2, 2008

My Idea to Boost Education by Stock Market....Thinks Over IT

Pick up a news paper every morning and the odds are more that you see graphs showing Sensitive SENSEX touching new highs or India is rapidly heading towards two digit GDP, inflation is going down, retail boom. With all this number crunching happening in India and portfolio of rich making them more rich no one takes time to think about to think about what would be the future of a country which has majority of illiterate young generation. Our education system i think is in shambles. Again there is number crunching happening in number of literate and illiterate children in India but no one is giving a damn about quality of education in this country. Although i would say all these SENSEX news only instigate me to think about how we might possibly improve education system in our country exploiting this Sensitive SENSEX.
Ever since I got to know stock market one thing I scrutinized is that every company nowadays have dream of getting listed on stock market garner huge sums of money for their future business plans, corporates providing ESOPS to their employees to attract best talent and all these strategies to scale business is increasing profits of corporates by leaps and bounds in addition to growing pressure from stockholders to improve quality of their products. Now considering our schools and colleges as corporates and mapping products of these corporates to students I think we can achieve the same level of quality in education system as we are getting in Indian manufactured products or from services nowadays. Now let me explain it in detail how this can work and fit in our society.
From my point of view there are two major stumbling blocks in our education system, one is that most of the schools dont have sufficient liquidity to hire best talent and the second one is that those who have enough cash dont have any pressure or some sincere body to monitor whether our education system are producing quality products or not, although government is pouring hugh sums of money to all funded institutions but that money doesn't trickle down to institutions in pure vertical manner in fact it takes a shape of inverted pyramid when it reaches to institutions due to vested interest of many people. So now my point is if we make these educational systems public i.e get them listed on stock market these systems will start getting huge sums of money and since nowadays investors are wise enough where to invest they would take out there money if the institutions are not providing quality products i.e quality students, also there should be some mandate for schools to provide ESOPS to parents of students which would lure the parents of children, who don't send their children and make them work to earn money from childhood, to send their children to school to study in order to earn as the share prices rises.
Although I have not yet thought about feasibility of this thought but I would say there must be this or some other way to improve education in our country because that is the key to really become superpower and not just doing producing good numbers of GDP or SENSEX in newspaper headlines or breaking news on News Channles.

Thursday, March 8, 2007

World is Flat by Friedman in Piyush's Word

Reading novels was never been my cup of tea until I entered into my professional life 3 years ago. Few days back i got to know one the best sellers World is Flat by Thomas Friedman, when I first saw this book I was never sure that I could read this book completely as it was a hefty one, but still i mustered up some courage and started reading that book, to my astoninshment this book had nothing related to geography as it seemed to me from the title. The whole subject of this book revolves around how a single topic that how coorporates and government of different countries around the globe have made this World a beautiful place to live and making lives of billions of inmates of this planet much more comfortable.
Although there is one more angle in my view to this book, it shows how the world is shifting its focus from developed to developing countries, how the dependency of global economy shifiting gradually from developed to developing countries all this mainly atttributed to splendid growth posted by two major asian giants India and China.
So all in all I would say if you have any interest in globalisation or want to know why you don't fall down on earth while walking since as per scientists it a sphere and not flat like a cricket ground just read this book, this is a philosophical way of proving that our world is flat not sphere nowadays.