Find the nth element from the end of the node in LinkedList

Supposed that there is a linked list with this content:

  • 5: Rafsan Adam
  • 4: Andre
  • 3: Cindy Patricia
  • 2: Stephen D. Burd
  • 1: Nyoman D. Nata
  • 0: Freddy Aries

When I enter ‘3’ it will return the 3rd element from the end of the list, counted from 0, it returns “Cindy Patricia” which key itself is 3. The thing is, we can’t use key to determine the position as the key may not be integer.

Continue reading

Removing Duplicate Node From A Linked List

This is actually a question from careercup.com. At first, I thought this question is easy, but later it seems it is harder than what I think. Sometimes, when you think something is easy, it is not that really easy, especially talking in computer programming languages: a world that is not real.

So. I already try to solve this last night, but I can’t. However, it seems that my energy is not wasted. After breaking for a while from ‘memorizing’ (I hate it) for software project management, I try to do the question again and I solved it!

Continue reading

Plain English Explanation of Binary Tree with Java Code

Binary Tree is one of the most amazing data structure some one has come up with which I have a chance to learn it right now. Actually this was the most amazing of data structure I had to know. Guys, I really regret that during high school I think it was never be possible to learn linked list, hell, linked list is so easy :D. Okay, let’s learn binary tree!

Continue reading

Java Complete Application for Singly Linked List

Today’s tutorial class, I got a question for the lecturer to implement a singly linked list into a complete, working example of Java command line program. The whole class get 2 hours for programming this, and I completely finished within the first one hour. In my opinion, this program is not so challenging, maybe a doubly linked list would make this program a bit more challenging.

Continue reading

Implementation of Stack for Checking Incorrect Braces Used to Validate HTML Source Code in Java

HTML is a page-format language which is used to format how an internet browser should deliver a content to the user. HTML (and CSS) is not really a programming language. However, HTML is important here for illustration of how stack can be used to detect mismatch opening-closing braces.

Continue reading

About Stack, a Computer Abstract Data Type (ADT).

Stack is one of computer abstract data type, that usually will be learn by programmer during data structures class. Stack is a very simple data structure. Stack is really a ‘stack’ in a real world. Imagine a stack of book, you put the book a, book b, and then book c. The most top in the stack is book c (which is the last inserted), and the most at the bottom is book a (which is the least inserted, the most-senior).

Continue reading

Simple Linked List implementation in Java

Have you ever wondered what is Linked List? Linked List is a dynamic abstract data type comprised of node(s). By meaning of dynamic, the size of Linked List can grow and shrink. There are many types of Linked List, however, the most simple one is Singly Linked List. One you mastered how to create singly linked list, the other type of linked list (doubly linked list and circular linked list) is just a matter of expansion.

Continue reading

Understanding Java Polymorphism: The Easiest Way

Classmate of mine–is not actually a classmate, but can be said classmate because at that time I enter the class that not belong to my (even though¬†the same Java class) and one of them did–said: “This class should not be called Java 2, should be Java 10, or Java 100”. All laugh.

Yeah, no one can deny that the logic in polymorphism was not easy at the first time. Even the most advanced programmer had time to imagine what the hell was that. Come’on, don’t said you understand¬†Pythagoras, Algebra, chemical equilibrium since you were 5th grader. Gosh!

Okay okay. Then how we can learn it the easiest way?

Continue reading

What women want men to do (In Java)

Woman is far more complex than man. They both are not only different in gender. They both are different in everything. Phiuwwww~ Imagine. I got a sister rite. She said to me that “Wah… that pinky blanket is good”. I never know, or never turn into thinking (up until before I write this) that what she actually really want to say is “Wah… I want that pinky blanket in my pinky bed”. Phiuw~

That’s only a sister.

How about girlfriend?

Uh oh.. like another programmer, girlfriend is… hahahaha 0.0 my God, I also want to have girlfriend lah. #foreverAlone

Okay okay, shut the fk up. Get the fk out. Now let’s continue with what I mean. Please read the code snippet bellow:

what girl want

Hahaha. You see. When woman said “I want blablabla”. Actually, she already did a technique like encryption but not really an encryption. It just a biased technique to make it ‘more deeper’ in meaning in that way if man knows what she really wants, then she will appreciate it highly, otherwise, whatever you did or are doing, is nothing for her.

Wowwww…. (?)

But wait. Can men really uncover or unbiassed the technique the girl was employed? Hmb… nothing can asure for that even assurance company won’t assure you.

Now let’s run the entire program. You will got:

I know that is crazy. But. That is true also. This is how their brain is working. All the time.

Missing feature in Java

Even though I do criticism on Java so much like in this post, I did that because I fell that I fall in love with Java. If i am not, just did criticism, without love, then I spend time for nothing, rite? Here is another feature I feel java miss.

Image

I just realize it when doing something with JOptionPane. Isn’t it be nice if we can increment (or decrement) not only variable… but also an integer/double (or numeric datatype other than that) -returning method. Fhhiiiuuewww… java can’t do that.