Search Results

Search found 2185 results on 88 pages for 'merge'.

Page 11/88 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Merge sort. ArrayIndexOutOfBoundsException [migrated]

    - by user94892
    When I execute the program I am getting an error as stated below the program. Please help me figure out the problem.. import java.util.*; class Mergesort { public static void main(String args[]) { Scanner in= new Scanner(System.in); System.out.println("Enter the number of elements"); int n= in.nextInt(); int a[]= new int[n]; System.out.println("Enter the contents"); for(int i=0; i<n; i++) { a[i]=in.nextInt(); } a = mergesort(a,n); for(int i=0; i<n; i++) { System.out.println(a[i]); } } public static int[] mergesort(int[] x, int z) { if(z==1) { return x; } int b[]=new int[z/2]; int c[]=new int[z-z/2]; int i,j,k; for(int p=0;p<z/2; p++) { b[p]= x[p]; c[p]= x[p+z/2]; } c[z-z/2-1]= x[z-1]; b= mergesort(b,z/2); c= mergesort(c,z-z/2); for(i=0,j=0,k=0; k<z; k++) { if(b[i]<=c[j]) { x[k]=b[i]; i++; } else if( b[i]>c[j]) { x[k]=c[j]; j++; } else if(i== z/2) { x[k]= c[j]; j++; } else if(j == z-z/2) { x[k]= b[i]; i++; } } return x; } } Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at Mergesort.mergesort(Mergesort.java:41) at Mergesort.mergesort(Mergesort.java:36) at Mergesort.main(Mergesort.java:16)

    Read the article

  • Merge home directory after fresh installation with existing (Gentoo) home

    - by jhwist
    I reinstalled my desktop machine with Ubuntu 10.10., coming from Gentoo where I used XFCE. My home is usually NFS-mounted from a server. During the install I let the installer set up my user, but of course my NFS-home wasn't mounted then; I have a regular /home/user now. If I mv /home /home.old and mount my NFS-home to /home instead, I cannot login because Gnome complains about some config-files (sorry, no exact error message as there is no way to copy&paste this). Which of my /home.old/user directories do I have to copy over to my NFS-home so that Gnome is happy again?

    Read the article

  • How to add a daemon to a quickly project

    - by darkrex1986
    Currently I'm developing an application with quickly which is divided in two parts: A graphical UI where the user could configure some things, and a daemon which do the most work in the background. I started with the UI, to create some windows for settings and so on. Now I want to start coding the daemon, but I have no clue how to implement the daemon in my quickly project. Could I simply paste the files of the daemon in project folder or is there an implementation method for adding new files to a quickly project? Or do I have to create a new project and merge them together?

    Read the article

  • Blender 2.6: How to Merge the Pros of Meshes and Surfaces

    - by fridojet
    there are two interesting kinds of objects: Meshes and Surfaces. Each of them offers very cool features. Object Type Specific Features Nice Features of Surfaces: (for example) They're as scalable as vector graphics (really nice!) You can build winding things real simply. Nice Features of Meshes: (for example) You can build organic things really good using the Sculpt Mode and a graphic tablet. You can use some special things like Physics. My Question There are things for which Surfaces are better and things for which Meshes are better. But how can I use both the best features of Surfaces and the best features of Meshes on one object at once? For example: How can I use Physics (like on Meshes) on lossless scalable objects (like Surfaces)? Thanks.

    Read the article

  • how to merge multiple url/path into multidimensional array ?

    - by KelNoReem
    I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] => site\projects\terrace_and_balcony\new_york.jpg [2] => site\projects\terrace_and_balcony\berlin.jpg [3] => site\projects\terrace_and_balcony\Kentucky.jpg [4] => site\projects\terrace_and_balcony\Utah.jpg [5] => site\projects\terrace_and_balcony\Hawaii.jpg [6] => site\projects\private_gardens\mexico.jpg [7] => site\projects\private_gardens\new_york.jpg [8] => site\projects\private_gardens\berlin.jpg [9] => site\projects\private_gardens\Kentucky.jpg [10] => site\projects\private_gardens\Utah.jpg [11] => site\projects\private_gardens\Hawaii.jpg ) How to convert it to that: $path11 = array ( "site"=>array ( "projects"=>array ( "terrace_and_balcony"=>array ( "mexico.jpg", "new_york.jpg", "berlin.jpg", "Kentucky.jpg", "Utah.jpg", "Hawaii.jpg" ), "private_gardens"=>array ( "mexico.jpg", "new_york.jpg", "berlin.jpg", "Kentucky.jpg", "Utah.jpg", "Hawaii.jpg" ) ) ) );

    Read the article

  • Can you precompile and merge part of an ASP.NET website and then continue development?

    - by michielvoo
    A big part of the web site is precompiled and merged, since it's almost never going to change. The precompiled bits can be replaced in case of updates to the original. I want to continue development of new pages, but when I browse to a new page I get the following error: The file '/Website/Test/Default.aspx' has not been pre-compiled, and cannot be requested. Is there any way around this? Edit: If I remove the precompileApp.config file I get the contents of the marker files when I browse them: This is a marker file generated by the precompilation tool, and should not be deleted!

    Read the article

  • Will this force a reinitialize in Merge Replication Topology?

    - by Refracted Paladin
    I need to add a couple of columns to a table that is a part of a replication set. It is not a constraint coulumn or a part of any article filters and it allows NULL. I have a pretty good idea that I can run this -- ALTER TABLE tblPlanDomain ADD ReportWageES VARCHAR (100) NULL and NOT force all my clients to reinitialize but I was hoping for some reassurance. Can anyone verify this one way or the other for me? Thanks,

    Read the article

  • git merge should ignore one directory

    - by dorelal
    I have tons of data in directory called reports. While doing git merge with another branch I am getting lots of conflicts for files under reports directory. I would like git merge to ignore files under reports. In another words I would like all the data from reports from master and not from lab branch. Is that possible? This is what I am doing right now. git checkout master git merge lab

    Read the article

  • Subversion merging, tree merge

    - by krystan honour
    I need to merge changes from a branch back into trunk but want to continue work on the existing branch. I was going to use a re-integrate merge but realised this is not suitable as I will need to recreate my branch etc which for a variety of reasons is not desirable. What I really want to do is merge the current revisions in the branch down to head and then keep people working on their current working copies. So my question is , can tree merge be used to solve this or do I have to reintegrate and recreate.

    Read the article

  • Git merge command

    - by Bialecki
    I'm reading the following article: http://github.com/guides/keeping-a-git-fork-in-sync-with-the-forked-repo, where they mention essentially pulling in changes from two repos at the same time by creating the following alias: pu = !"git fetch origin -v; git fetch wycats -v; git merge wycats/master" This makes sense, but, as someone new to Git, I'm curious why the commands is that versus: pu = !"git fetch origin -v; git merge origin/master; git fetch wycats -v; git merge wycats/master" or something along those lines. Basically, I'm wondering why the argument to merge is wycats/master and how it knows about origin/master automatically. Looking for a quick explanation.

    Read the article

  • Simple bad merge scenario in mercurial

    - by user281180
    I have created a repository AAA and another BBB. In AAA I have created a file A with the values a1, a2, a3 and commit In BBB I have created a file B with the values b1, b2, b3, commit and export a bundle. I add the bundle in AAA and merge. I make a change in B, and write b33 in AAA and another change in B and write b23 in BBB. and commit both. I create bundle of BBB and add the bundle in AAA. I do a merge. Now I decide to revert to the revert to step 2. I no more want to have the merge of 4. changes done in B as they were bad merges. Now I want to add the bundle of 3 but I can see that it can`t see any changes anymore. Why? How can I do the merge once more?

    Read the article

  • SQL Server Merge statement issue

    - by George2
    Hello everyone, I am learning and using SQL Server 2008 new Merge statement, merge statement will compare/operate source table and destination table row by row ("operate" I mean operations performed for when matched or not-matched conditions). My question is whether the whole merge process will be one transaction or each row comparison/operation will be one transaction? Appreciate if any document to prove it. thanks in advance, George

    Read the article

  • How can I merge two lists and sort them working in 'linear' time?

    - by Sergio Tapia
    I have this, and it works: # E. Given two lists sorted in increasing order, create and return a merged # list of all the elements in sorted order. You may modify the passed in lists. # Ideally, the solution should work in "linear" time, making a single # pass of both lists. def linear_merge(list1, list2): finalList = [] for item in list1: finalList.append(item) for item in list2: finalList.append(item) finalList.sort() return finalList # +++your code here+++ return But, I'd really like to learn this stuff well. :) What does 'linear' time mean?

    Read the article

  • TFS 2010 Source Branches Never The Same

    - by Lukasz
    I have my root branch lets call it Alpha and one branch that was branched from that root lets call it Beta. I made some changes in the Beta branch and merged them back to Alpha. In theory now Alpha and Beta should be identical branches and when I do a diff they are identical. If I attempt to merge Alpha with Beta again without making any changes the changes I originally merged from Beta to Alpha will merge again from Alpha to Beta. Completing that merge and checking in the branches are the same. Now I can merge again. I can do this over and over again with no end. I was just wondering if anyone has ran into this problem before and how it can be fix. At first I thought it was harmless but when I make more changes in the Beta branch and merge the new changes as well as the original changes get merges overriding changes to these files making a mess. Thanks!

    Read the article

  • Could I use Revert after abrupting Merge?

    - by John
    Hallo all, Just now I tried to upload a modified working copy to its branch in the following steps: 1. Update 2. Commit Then I attempted to Merge the changes in the trunk to this branch. However during editing of the conflicts I realized there were so many conflicting codes that I could not address completely today, then I gived up the Merge, and the working copy got an exclamation mark immediately. Thru Check for modifications I found that many many files had been modified or had conflicts. It seems that the Merge has been somehow wrongly carried out. My question: could I return to the state before the Merge simply using Revert? Thanks a lot in advance, John

    Read the article

  • Is this a bad version of the Merge Sort algorithm?

    - by SebKom
    merge1(int low, int high, int S[], U[]) { int k = (high - low + 1)/2 for q (from low to high) U[q] = S[q] int j = low int p = low int i = low + k while (j <= low + k - 1) and (i <= high) do { if ( U[j] <= U[i] ) { S[p] := U[j] j := j+1 } else { S[p] := U[i] i := i+1 } p := p+1 } if (j <= low + k - 1) { for q from p to high do { S[q] := U[j] j := j+1 } } } merge_sort1(int low, int high, int S[], U[]) { if low < high { int k := (high - low + 1)/2 merge_sort1(low, low+k-1, S, U) merge_sort1(low+k, high, S, U) merge1(low, high, S, U) } } I am really sorry for the terrible formating, as you can tell I am not a regular visitor here. So, basically, this is on my lecture notes. I find it quite confusing in general but I understand the biggest part of it. What I don't understand is the need of the "if (j <= low + k - 1)" part. It looks like it checks if there are any elements "left" in the left part. Is that even possible when mergesorting?

    Read the article

  • Merge Sort issue when removing the array copy step

    - by Ime Prezime
    I've been having an issue that I couldn't debug for quite some time. I am trying to implement a MergeSort algorithm with no additional steps of array copying by following Robert Sedgewick's algorithm in "Algorithm's in C++" book. Short description of the algorithm: The recursive program is set up to sort b, leaving results in a. Thus, the recursive calls are written to leave their result in b, and we use the basic merge program to merge those files from b into a. In this way, all the data movement is done during the course of the merges. The problem is that I cannot find any logical errors but the sorting isn't done properly. Data gets overwritten somewhere and I cannot determine what logical error causes this. The data is sorted when the program is finished but it is not the same data any more. For example, Input array: { A, Z, W, B, G, C } produces the array: { A, G, W, W, Z, Z }. I can obviously see that it must be a logical error somewhere, but I have been trying to debug this for a pretty long time and I think a fresh set of eyes could maybe see what I'm missing cause I really can't find anything wrong. My code: static const int M = 5; void insertion(char** a, int l, int r) { int i,j; char * temp; for (i = 1; i < r + 1; i++) { temp = a[i]; j = i; while (j > 0 && strcmp(a[j-1], temp) > 0) { a[j] = a[j-1]; j = j - 1; } a[j] = temp; } } //merging a and b into c void merge(char ** c,char ** a, int N, char ** b, int M) { for (int i = 0, j = 0, k = 0; k < N+M; k++) { if (i == N) { c[k] = b[j++]; continue; } if (j == M) { c[k] = a[i++]; continue; } c[k] = strcmp(a[i], b[j]) < 0 ? a[i++] : b[j++]; } } void mergesortAux(char ** a, char ** b, int l, int r) { if(r - l <= M) { insertion(a, l, r); return; } int m = (l + r)/2; mergesortAux(b, a, l, m); //merge sort left mergesortAux(b, a, m+1, r); //merge sort right merge(a+l, b+l, m-l+1, b+m+1, r-m); //merge } void mergesort(char ** a,int l, int r, int size) { static char ** aux = (char**)malloc(size * sizeof(char*)); for(int i = l; i < size; i++) aux[i] = a[i]; mergesortAux(a, aux, l, r); free(aux); }

    Read the article

  • How to merge after reverting in mercurial?

    - by user281180
    I have had a bad merge. Now I want to start the merge all over again. I did a revert just before the merge. Now when im trying to add the bundle , im having the message and it can no more locate the changes. What is wrong? Why isn`t it finding any change? c:\Documents and Settings\Shamima\Desktop\New Folder\test_rev94_to_tip_hg\test_rev94_to_tip.hg searching for changes no changes found [command completed successfully Tue Apr 13 16:10:37 2010]

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >