Can somebody tell me which example is right when a question that is given to me says to bubble sort a list of numbers 7, 12, 5, 22, 13, 32? I found two examples and one was with a graph that included Original List, Pass 1, Pass 2, Pass 3, Pass 4, Pass, 5, and Pass 6, the numbers with 7 on one...
I'm a little bit over half way through my PhD (particle physics) at a good UK university and I don't know what I'll do next. So far the only things in my head are "post-doc" or "something else", but I'd like to know roughly what sort of wage you would be happy with if you were in my shoes...
I have seen in books that when number of elements is small ~ 30-40 insertion sort is recommended. Why is that? The worst case of insertion sort is n2 whereas for quick-sort it is nlogn.
nlogn beats n2 for all values of n isn't it? Then why?
This isn't so much a challenge problem as much as it has a startling (at least I think so) answer.
Say we tie a rope around the Earth. Now we are going to cut it and add another 6 meters to it. If we pull the new rope tight (in a circle) how high is the new rope above the Earth's surface...
Just wondering if the Java experts here could help me. As part of a project I'm making a function rand9() that returns a pseudo-random number 0 through 9. The problem is that each time it's called I need a certain number to increment so that it can generate a new (not necessarily different)...
This came up at lunch today when a friend of mine brought up that he had recently watched the Nova episode of Fabric of the Cosmos where they talk about spacetime as a sort of loaf where relative motion has the effect of cutting different angled slices out of the "loaf" of space time (for those...
Let's say that a planet of approximately Earth's size - containing, as Earth does, core heat - were tossed out of orbit. Could it maintain any sort of atmosphere, or would all the component gases liquify and freeze, or be gradually lost to space? If it could retain any atmosphere, what gaseous...
I have 2 possibilities, non of them worked:
PD: I am sure that all the methods inside this method(s) are correct and I am sure that the program's GUI is refreshing effectively.
public void metodo1()
{
for (int i=0; i<(perros.size()); i++){
for (int j=perros.size()-1...
{ y }_{ f }={ y }_{ i }+{ v }_{ yi }t+\frac { 1 }{ 2 } { a }_{ y }{ t }^{ 2 }\\ { v }_{ yf }={ v }_{ yi }+{ a }_{ y }t
It almost looks like the second equation is the derivative of the first equation with respect to time.
Hello,
I need to analyze some bubble sort algorithm and calculate the probability of each conditional statements(if,for,while,ect...) be successful. I can post the algorithms if you need to see them.
Thanks in advance
Homework Statement
How many comparisons does the insertion sort use to sort the list n, n-1, ...2, 1?
Homework Equations
The Attempt at a Solution
Insertion sort compares every element with every other element in the list, but I'm unsure what this question is asking. Why does it...
I am looking for a term to describe a sort of "optimization" that I am trying to do.
Hi everybody, I am a college student who unfortunately is not smart enough to be a math major. But nonetheless I am obsessed with statistics and numbers. I have a question:
I need help figuring out a term...
... and for a long time, I took this for granted, but now I'm starting to wonder how it is doing this. From my knowledge, the only way one could calculate pi is to measure the diameter and radius of a circle, and find the ratio, but to calculate an irrational decimal as thoroughly as we have...
please help me with a c code for the merge sort... and i am getting a segmentation fault in running this selection sort,,, please help...
#include <stdio.h>
int main( )
{
int arr[10];
int i,j,temp;
for ( i = 0 ; i<10 ; i++ )
{
printf("enter the numbers: \n");
scanf("%d \n", arr[i]);
}
for (...
Hello, this is sort of a big program and I wrote out the program, but I'm unsure about a lot of things.
The program is supposed to give the user a menu of choices:
1) Fill the array with random numbers.
2) Print the array.
3) Search the array.
4) Sort the array.
5) Quit.
Option one is...
I want to work in massive industrial scenarios - power plants, oil refineries, steel mills, oil rigs, etc.
Now I know that there are probably multiple that are more specialized for each of these, but is there one engineering that sort of encompasses all of these and would allow one to have a...
I admit I don't know anything about string theory (nobody really does at an undergraduate level) but it sounds interesting and seems like something challenging. I am majoring in physics and maths but I am getting to the point in my undergraduate studies where I can begin to specialize more in my...
I don't think this is technical enough to post it in EE so I'm hoping someone
in my project my supervisor bought this thing, it's power supply uses a cable shown in the attached image, problem is it is about a foot long. For the sake of a tidier work space we are trying to find an extension...
I have a list of urls I need to sort but I need to sort them only using the letters in the url?
Eg.
example.com/174353/a
example.com/3452344/c
example.com/435322/d
example.com/2342/b
example.com/23456/e
Would be sorted as:
example.com/174353/a
example.com/2342/b
example.com/3452344/c...
I'm working on a design project and I need to find what I would call a 'cable quick release'. Basically, I need to be able to quickly release a cable that has ~3500 pounds of tension in it. Ideally, one would just use a pin you could pull out, but I'm fairly certain that would be difficult if...
Hello everyone,
Long long ago, I thought of being a physics major. When I came into into college, I had no experience with physics, problem sets, mathematics higher than trigonometry(very little trig), or much science(my school didn't really offer good science classes). I discovered physics...
So I have a simple selection sort function written. It takes an array of type double as the array to be sorted. If I declare the array to be of type int in my main program and then pass it to my sSort function, it gets mad. There must be a way that programmers deal with this kind fo stuff.
Here...
Homework Statement
to accept 10 names and print alphabetically
Homework Equations
The Attempt at a Solution
public class n1_s
{void main(){
int min,c,q;String t;
String n[]={"b","k","a","w","e"};
for(int i=0;i<4;i++)
{min=i...
Hi
I'm trying to program a merge sort algorithm on python but it just doesn't work!
I first implemented a fusion algorithm which takes as arguments a list A divided into 2 sorted sub lists A[p..q] and A[q+1..r]. Fusion then returns the list A completely sorted.
This program seems to work...
Hello guys, I'm new to the forums and am in need of some guidance.
I left secondary school in 2008 with beyond terrible GCSE's. All my school life I had been an exceptionally hard worker, and had been predicted A's in most of my GCSE's. Then something happened in my life that crushed me...
This was written in python as an excersie, it's a terribly inefficient use of python. Still I don't understand why the sort doesn't stop as soon as possible
can anyone one point out the error?
def bubbleSort (theList):
size = len(theList) - 1
while (size > 0):
index = 0...
I'm studying for a quantum exam and there is this symbol that looks like an inverted plus minus but the minus is attached to the plus...
kind of like
_
+ but attached.
in context:
"x ± vt = constant or x = (-/+) + constant."
Thanks for any speedy help!
I am hoping to do mathematical or theoretical physics after my undergraduate science degree. I have been advised to do more maths subjects than physics subjects in order to achieve this. I am double majoring in maths and physics and I am just wondering what area of maths I should be focusing on...
So i haven't done java in about two years, its been a while since I've seen arrays. THe assignment is to fix a program that was given to me. I found one error but in the insertion sort part i can't get it to run the while loop. I can't make any fundamental changes to the program, basically i...
Hi,
I am trying to write a program that sorts an array of random numbers.
Unfortunately, it does not work out as i had hoped, I am getting some strange output.
Here's my code:
#include <stdio.h>
#include <stdlib.h>
/* Function Prototypes */
int rand(void);
void srand(unsigned...
Good morning,
I implemented the Binary Insertion Sort algorithm in C++, and now I want to analyse its time complexity. This is the Insertion Sort algorithm, but the linear search technique (which is used for locating the position in which to insert a particular integer) is replaced by a binary...
Solving a cubic... sort of!
Hi,
Can the equation \sqrt{Ax-x^3}+\sqrt{Bx-x^3}=C be solved explicitly?
All of MathLab, Maple and WolframAlpha seem to give an explicit solution but they don't show how they come to it. I'm afraid they may be missing other possible solutions.
Thanks,
I am trying to write a computer program that involves finding 2 very large numbers (several thousand digits) and dividing them to get a reasonable sized number.
the first number is a value of the gamma function, which can be defined as a product and thus easy to reduce with logs (find the sum...
Hey guys,
I'm looking for some sort of mosfet/relay/switch that can handle up to 1 milliamp and 8kV. I don't understand the technology very well, but from talking to some people, I know I can put 2 4kV mosfets in series to achieve my 8kV goal. On the other hand, while looking for relays, I...
Homework Statement
Hi there, I wish this wasn't my first post but unfortunately, it is. I will try to contribute later in the semester when my workload is less.
On to the topic, the problem is I have to implement the insertion sort algorithm on a linked list. I have the algorithm for Java...
import javax.swing.*;
import java.util.Arrays;
public class sortSelection
{
public static void main(String args[])
{
String inputString;
char temp;
inputString = JOptionPane.showInputDialog("Enter Your Name");
char a = inputString.charAt(0);
char b =...
I would like to know if someone here can help sort out my confusion...
It is easy to derive that
dU=TdS-pdV (no particle exchange)
Then enthalpy H=U+pV
will imply dH=TdS+Vdp
That means under a constant temperature (dT=0) and constant pressure (dp=0) situation
dH=TdS>(=) dQ
Why is it...
a friend and i plan to design and fabricate a sort of home radar/tracking system.the objective goes like this.there is a dark room and we are flying a remote controlled helicopter(a small one).it is desired that a radar/tracking system placed on the floor should track it,follow it and hit it...
Homework Statement
A 1.71 kg package is released on a 54.1 deg incline, 4.00m from a long spring with force constant 141 N/m that is attached at the bottom of the incline . The coefficients of friction between the package and the incline are 0.39 and 0.24. The mass of the spring is...
Are you the sort of person who sees a new gadget for the home, and thinks it's a must have,
or are you the type of person who still has such like a none electric can opener.
We've all heard of the three states of matter: solids, liquids, and gases. Recently someone told me that there is some sort of state of matter between a liquid and a gas. Does anyone know what he's talking about?
Masters in some sort of "Energy" discpline
Currently I am in the final year of a 3 year degree in Physics, and I have decided I would prefer to do something much more practical.
I would like to get into the energy industry, as such I am looking to apply to universities offering Masters...
Homework Statement
Here's the original problem in all of its glory...
\int_0^{T/2} \,\sin((2\pi(t)/T) - \alpha) \, dt
Homework Equations
U Substitution
Trig identities (possibly)
The Attempt at a Solution
Using U substitution I've got u=2\pi(t)/T -\alpha
Which means that du= 2\pi/T dt...
Homework Statement
A cable supports a cylindrical beam at point B. For the given loading conditions, what type of supports, applied at point A, would improperly constrain the beam, would constrain the beam and make the beam statically determinate, and would constrain the beam and make the beam...
Hey all,
I'm wondering if anyone here can help me try and get things straight in my mind about what I'm going to do next. I'm currently studying Part III (the courses in QFT, Symmetries, Strings etc) and already people are starting to talk about PhD applications, since it seems to be assumed...