Algorithms – What is the probability of comparing the small and the largest element in the array when randomly selecting the pivot element?

Consider the recursive quick sort With random pivoting every time a random panning element is evenly selected. When this randomized algorithm is applied to an array with n different element, what is that probability that the smallest and the greatest Element will be compared during the execution of the algorithm.

Algorithm Design: Efficient O (n) algorithm to obtain the ith to jth largest element in an array

I'm trying to design an efficient algorithm that gets the ith to jth largest elements in an array. For example, if the following array is the input:

(10, 14, 18, 3, 21, 25, 27)
i = 2
j = 4

The following array is returned:

(25, 21, 18)

18 is the fourth largest element in the array and 25 is the second smallest element in an array. I've fixed a problem in which you get a list of the K largest elements in an array: For such a problem, the solution is quite trivial (using a fixed size minimum hump of size K to keep track of the K largest elements). , However, in this case, a heap does not seem to be within reach, as the minimum heap can only remove the smallest element from the heap (removing the kth smallest element in the heap really does seem inefficient).

I could do QuickSelect (j – i) times to get all the elements, but that means I'm doing a linear O (n) roll through (j – i) time that has a total time complexity of O ((ji) * n). but I was wondering if it is possible to speed up the temporal complexity of the algorithm to just O (n). Is there an O (n) algorithm to solve this problem?

sharepoint online – Creates an element attachment from a template based on multiple elements

To explain the question better, I explain what I want to finish. So, we have a person requesting parts through SharePoint, adding a new element with all the details, and adding an automatic request form to that element using flows. Then another person takes this item and orders the parts mentioned. The problem now is that often multiple parts need to be requested in the same order, and the final request form must contain all parts instead of creating a single sheet for each part. My question is, is there a way to create multiple elements and combine flows and generate a single attachment for all created elements? or sub-elements for a single request?

css – Bring the Hero element to full width

I'm trying to learn a few new designs.

Consider this sample website:


* please do not do that Not My design, I show it because that's the effect I'm aiming for.

The image of the boy actually sits in the hero element and somehow the designers have managed to design the element in full width (on all devices). On my side:

Although I coded it as:

.hero {
  height: 1334px;
    Width: 1110px;
    background-image: url("wp-content/uploads/2019/09/hpimage-2.jpg");
  color: transparent;
  background: #000000;
  padding: 0px;
    background-size: contain;

The container does not reach the pages of the pages (I marked the background in yellow to highlight it). Does anyone know how I can achieve the effect that I see on on my website?

Thank you very much,


Graph theory – For given element pairs that belong to different groups, find a possible distribution of the groups

If we are given N Inputs of the form u v which means, that u and v Belonging to the same group, then we can use the concept of disjoint set to form the groups.

Is however instead the input u v means that u and v belong to different groups. How should we then proceed to find a possible distribution of groups so that they follow the above? N Criteria?

Java – Create a new element instance only if two objects have different signatures

When adding to a product list, a new instance of a type A product only needs to be created if the incoming entry contains at least one variable of a different value than the one already in the list. If same signature, increment count. Else, store as new instance
e.g. CarType aCar1={"color":"Red"
} CarType anotherCar={"color":"Green"} /*Should result in creation of new Car()*/
but CarType aCar3={"color":"Red"} /*Should result in incrementing the count of aCar1 */ Code can be in Java, PHP or Javascript

views – views_pre_render Adds a class element to a line

When pre-rendering a view line, is there a way to insert a class into a single element so that I can add a new background color to the event element to emphasize its meaning? Below is what I have so far.

  if ((int)Drupal::currentUser()->id() === 1) {
    foreach ($view->result as $key => $value) {
      try {
        $field_result_value = $value->_entity->field_display->getValue();
        if (isset($field_result_value(0)) && (int)$field_result_value(0)('value') === 1) {
          // add a class to the change the background color to hi-light its importance 
      } catch (Exception $e) {