May 2014 Rui Game company Java interview Experience

Source: Internet
Author: User

Because the classmate introduces, throws a resume, goes to the company interview. The Java Engineer is reported.

First, introduce yourself, ask the next item, write a binary lookup insert, and return the location information you want to insert.

I had to write this when I was interviewing one months ago, but I thought Java was pretty good. It is written in Java, go back to see if there is no mistake; today, because just saw the fast platoon, always thinking about the fast row of things, plus the next door someone in the interview sound very big feel slightly noisy, write a good mess, and then write a bit, But it seems to be wrong.

Next, put a single linked list upside down and ask the algorithm.

I put the tail pointer to the head formation ring, easy to traverse, and then to rebuild one. Feel very slow. Later thought is also the end of the exchange, the time should be only half less.

Asked the Java and C + + differences (JVM, then the JVM in different operating system implementations are the same?) Ask the Java class what the classes used, ask the thread, sync (sync synchronized what the object is.) )。 Ask StringBuilder if it has been used.

Asked the sorting method, the time complexity, lets write the quick row.

Asked TCP/IP HTTP, not very much.

Look I have learned soft work, ask design mode, let's say, I said MVC, he said it doesn't count ... Ask the Factory mode, not.

Why come to the game company, whether like to play games, how long can come, usually hobbies, after the study abroad to work.

Later, and students to exchange, asked the content:

Two single linked list, how to judge whether cross;

Give a bunch of numbers, find the biggest one, and find the biggest 5.

What language is used in the database (. mdb)

Multithreading synchronization problem, when will deadlock.

That's about it. After coming back to realize a bit, found himself wrote that really wrong, I foolishly used recursion (although also can). Here's just a binary lookup and a binary insertion.

Package sort;

public class BinarySearch {

	/**
	 * @param args
         ////Use while statement to implement a binary public	 
         	static int BinarySearch (int [] A, int key) {
		int left=0;
		int right=a.length-1;
		while (left<=right) {
			int mid= (left+right)/2;
			if (Key<a[mid]) {
				right=mid-1;
			}
			if (Key>a[mid])
				left=mid+1;
			if (Key==a[mid]) return
				mid;
		}
		
		return-1;
	}
	Using recursion to realize two points
	public static int BinarySearch1 (int[] A, int key, int l, int r) {
		int mid= (L+R)/2;
		if (l<=r) {
		System.out.println (left: +l+ right: +r+ "Mid:" +mid);
		if (Key<a[mid]) return
			binarySearch1 (a,key,l,mid-1);
		if (Key>a[mid]) return
			binarySearch1 (a,key,mid+1,r);
		return mid;
		}
		else return-1;
	}
	The corresponding insertion, returning the inserted position
	public static int Binaryinsert (int[] A, int key) {
		int left=0;
		int right=a.length-1;
		while (left<right) {
			int mid= (left+right)/2;
			if (Key<a[mid]) {
				right=mid-1;
			}
			if (Key>a[mid])
				left=mid+1;
			if (Key==a[mid]) return
				mid;
		}
		
		return to left;
	}
	public static int BinaryInsert1 (int[] A, int key, int l, int r) {
		int mid= (L+R)/2;
		
		if (l<r) {
		if (Key<a[mid]) return
			binaryInsert1 (a,key,l,mid-1);
		if (Key>a[mid]) return
			binaryInsert1 (a,key,mid+1,r);
		return mid;
		}
		else return l;
	}
	public static void Main (string[] args) {
		//TODO auto-generated Method stub
		int[] a={1,2,3,5,7,9};
		System.out.println (Binaryinsert (a,4));

	}



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.