Dijkstra’s algorithm chooses the closest unvisited node to visit next, what would happen if we didn’t do this?

Why is it necessary to always choose the closest vertex to the source to visit next?

Say instead of picking the closest vertex I pick the furthest. Can someone give an example of a graph where this would give the wrong answer?

delete node from linked list (lang w/GC) -should deleted item ‘next’ be set to null

Regarding: delete a node from a linked list algorithm,in procedural languages with garbage-collection. Should there be a step in the algorithm, of setting the removed-node-next-pointer to null ?

(Several high-school-CS-teachers in my area teach YES, while others teach NO)

What is the right approach?

/thanks ran

How to go to the next line in Octave without executing?

I am a newbie in Octave, after writing a line in octave if I press enter it does not go to the next line but executes that line only…!! I have searched the internet for a day and found no useful content on this matter. Certain codes are not working for this, for example

enter image description here

This piece of code doesn’t give the desired output, when I type it like this and its get executed line by line. But if I type it like this–>

enter image description here

All in a single line it works fine and give me this desired output enter image description here

So, my question is How do I go to next line in Octave, without actually executing it??

Port Scanning: Question about next steps after Zenmap port scan

I am very new to offensive security

I have done a nmap scan on a public IP, its showing 4 ports open and the OS is undetectable, I have no idea how to proceed further, I appreciate any next steps further in this case. Below is a snippet from nmap output:

Not shown: 995 closed ports PORT     STATE    SERVICE      VERSION 25/tcp   filtered smtp 135/tcp  filtered msrpc 139/tcp  filtered netbios-ssn 445/tcp  filtered microsoft-ds 6009/tcp filtered X11:9  Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Aggressive OS guesses: ISS Proventia GX3002 firewall (Linux 2.4.18) (97%), Linux 2.6.22 (Debian 4.0) (97%), CMI Genus NEMA terminal (95%), D-Link DGS-1210 switch (95%), D-Link DI-604 wireless broadband router (95%), Efficient Networks SpeedStream 4100 ADSL router (95%), FreeBSD 6.1-RELEASE (95%), IBM i 6.1 (95%), Cobalt Qube 2700WG (Linux 2.0.34) (95%), Linux 2.4.20 (95%) No exact OS matches for host (test conditions non-ideal). 

Método next() de la interfaz iterator en una lista de pares en Java

estoy implementando el método next() en una lista de pares, Pair Un ejemplo sería [Pair(“hola”,1),Pair(1,9)] Tengo el siguiente constructor:

public ConjuntoIterator(PositionList<Pair<E,Integer>> lista) {      if (lista == null) {             throw new IllegalArgumentException ();          }     this.lista=lista;     this.cursor=list.first();     this.prevCursor=list.prev(cursor);     avanzaCursor(); } 

El método avanzaCursor()

private void avanzaCursor() {       while(cursor != null && (cursor.element().getLeft() == null || cursor.element().getRight()<= 0)) {           cursor = list.next(cursor);           }       } 

Y aquí tengo el método next()

public E next() throws NoSuchElementException {       if (cursor == null) {             throw new NoSuchElementException();          }       E elem = cursor.element().getLeft();       cursor = list.next(cursor);       avanzaCursor();       return elem;    } 

Y mi cuestión es que no consigo resolver que el next me de la parte Integer, pues solo me da la parte de E, ¿Cómo podría hacerlo,gracias?

The placement of Next button in app for warehouse men

The app will be used on an Android device with touchscreen but physical keyboard. The device allows for bar code scanning so there’s also a handle for more comfortable usage. There are a few steps that warehouse men have to perform in order to complete an activity of registering items delivered to stock. For each step they can either type information and click “Next”, or they can scan the information and be moved to the next page automatically. The client wants to have the summary of all steps visible on the screen constantly and there you can click on each of the info and edit if needed. The idea is as below:

Steps with problematic Next (arrow) button placement

So the question is, how to place the Next button in this case? We use Next only if we input information manually, otherwise it is done automatically. In the first screen it seemed logic that Next would be placed just next to a text field but then it is not consistent with other type of pages (2). If I place the next button at the bottom, it looks a bit odd on the pages like the first one.

Wait Command so Unrar will finish the first .rar then move to next

Below is the command user3140225 helped me out with and it works fine:

find /home/username/source/directory/ -type f -name "*.rar" -exec unrar e -o- {} /home/username/copy/extracted/to \; -delete && rm -r /home/username/source/directory 

Except I noticed it is uraring the .rar files from the separate folders (Folder1, 2) all at one time.

My structure is

  • SourceDirectory


    File .rar


    File .rar

I would like the one unrar to finish first before it goes on to the next one.

I am using cronjobs to run these commands. So if there is another way I would be grateful.

What’s the name for the notification pattern: waiting for the user to respond to a notification before sending the next one?

Some websites (e.g. some forums) send notifications like this:

  1. User asks multiple questions on the site
  2. Other users respond to the questions
  3. The website only notifies the user once (that there has been some activity since his last interaction with the site)
  4. The user logs into the site or interacts with the site
  5. More activities happen that the user should be notified of
  6. The website sends another single notification to the user

In short instead of sending one notification per each activity and potentially overwhelming or spamming the user, the user is only sent one notification and the system waits for the user to have an interaction with the site before sending the user another notification.

Is there a name for this pattern?

Expected value of next CPU burst using exponential averaging

The burst time is needed for Shortest Job First (SJF) and Shortest Run Time First (SRTF) scheduling. To get the approximate burst time, we use the equation $ $ \tau_{n + 1} = t_n + (1 – \alpha)\tau_n$ $

I want to ask whether $ \tau_{n + 1}$ is the predicted burst time of the $ n + 1$ th process or it is the predicted burst time of some process say p which is demanding the CPU for the $ n + 1$ th time.