TITLE
«   2009/01   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

 + 천국에서 지상으로 컴백
 + Abercrombie and Hollister
 + 투덜투덜
 + OPERA SOFTWARE
 + 여자친구에게서 걸려온...




 +  Jae-won.net
 +  Mini Stop
 +  Moreover
 +  the shadow of forgetful...
 +  썰렁한 엔지니어
 +  태우's log - web 2.0 an...


   SQL DB : 12.93 MB
   Server : 16.50 GB / 67.29 GB


   Browser : Robot
   OS : Robot


   IP :   [38.103.63.59]


   Total : 4


   Total : 303175 [03.05.2006 ~]

RealProject.NET Blog 섹션입니다. LOCATION  TAG  GUESTBOOK  ADMIN   
제 개인적인 잡생각이나 일상, 그리고 사진들을 올리는 곳입니다.
깊이 생각해서 쓰는 글보다는 순간순간 스쳐지나가는 생각들을 남기고자 합니다.
현재, 이 블로그는 Textcube 1.7.7 : Beta 1를 기반으로 운영되고 있습니다.
따라서, 메인웹사이트와 블로그 사이에 연동되는 부분이 한정되어 있으므로 이점 양지 부탁드립니다.
- Article Catagory -
2008/07/14 10:48 2008/07/14 10:48
- Finding a Loop in a Single Linked List -
  Author : JCrew
  Date : 2008/07/14 10:48
  Category : Essay
  Tags : , , , ,
  Trackback : http://realproject.net/blog/trackback/117

Recently, I had an interview with Rikard Gillemyr, VP Engineering of Opera Software. It was great experience that I talked to someone like him.

While interviewing, he gave me a simple data structure question (It has been a while since I worked on algorithm b/c joining the army, so I would say it was not that easy for me), and it was 'finding a loop in a single linked list.'

A single linked list is used as a stack. It is made of nodes where each node has a pointer to the next node or null to end the list. If there is a loop between any nodes inside of single linked list, then it might not get to the end node or contain more then two links to some node.

I found a solution (but not efficient), and it was checking the entire list everytime when a node gets to next node. It ends up with O(n^2) time complexity.

He tried to give me some idea so that I can improve this, but I could not. I got mad to myself little bit, so I tried find better solution without looking or googling anything, and I found one.

If we know the first and last node, and then we reverse the list, we can track back from last node to first node. If it does not get to the first node that we started before we reverse the list, then we can say there is a loop in this single linked list. It ends up with O(n) time complexity.

Eventually, I googled this to check whether there is better answer, and I found a website.

Link to http://ostermiller.org/find_loop_singly_linked_list.html

Like I said, it has been two years not working or reviewing on any algorithm stuff, so before I start refreshing my knowledge, this was very good point to start with. I really enjoyed and had fun.

Thank you, Mr.Gillemyr-

사용자 삽입 이미지
Rikard Gillemyr
began his affiliation with Opera Software in 1998, when he and the other co-founders of Hern Labs in Sweden ported Opera 3 to BeOS.
After officially joining Opera Software in 2000, Gillemyr has been responsible for many of Opera's major deliveries, including Opera on BREW and the Opera for Devices SDK. Gillemyr previously served as the country manager of Opera's offices in Poland and Korea before his appointment to Vice President of Engineering. He was educated at the Linköping Institute of Technology where he studied Computer Science and Engineering until 1999. Gillemyr holds 360 000 shares and 350 000 options in the company.


명언 한마디
나는 지금까지 세상의 온갖 위대한 인물들과 만나 왔지만 남에게 칭찬을 받으며 일하는 것보다, 남에게 비난을 받으며 일하는 편이 훨씬 더 좋다고 하는 사람은 아직 만난 적이 없다. -찰즈 슈워프
          
 List   Previous  1 ... 10 11 12 13 14 15 16 17 18 ... 118  Next 

- Real Project .NET은 Internet Explore 5.5 이상, Firefox 1.5 이상, Opera 8.0 이상, Safari 3.0 이상의 1024 x 768 Resolution에 최적화 되어있습니다.
- Real Project .NET에 게시된 정보는 '자료출처' 및 '관련링크'에 명시된 곳과 제작자에게 저작권이 있습니다. 이러한 게시물은 무단전재 및 재배포에 동의하지 않습니다.
- Real Project .NET에 게시된 정보 중 운영자 및 회원의 신상정보에 대해서는 어떠한 경우에도 수집을 거부합니다.