gr.group theory – Some sort of twisted group homomorphism

Start with a group $$G$$ that acts on a set $$X$$, and a second group $$H$$. We want to consider functions $$varphi: G times X to H$$ such that $$varphi(g g’, x) = varphi(g, g’x) varphi(g’, x)$$ for all $$g$$, $$g’$$, and $$x$$. Note that if $$X$$ is singleton (or if $$G$$ acts trivially), then $$varphi$$ is essentially just an ordinary group homomorphism. Is there a name for a function like this?

8 – Change sort order of SOURCE STRING list at User interface translation page to alphabetical instead of date created

At the User interface translation page (`/admin/config/regional/translate`) the SOURCE STRING list seems to be ordered by creation date/time (it is for strings I add). Is there a “good” (non-hackish) way to change the order to alphabetical? I haven’t found anything in the interface.

For those who wonder why I want this, I use interface translation in an unconventional way. Instead of putting literals like `t("Choose your options")` in my code, I put in a key like t(‘rsc-string-choose-options’) (rsc is the name of my custom module). Then as the translation, I put in “Choose your options”. This allows me to use “keys” for all strings (literals, messages, titles, email body text, etc.). It’s easy to look up my keys because they all begin with ‘rsc-‘ followed by ‘string’, ‘message’, ’email’, etc. depending on usage. Doing this provide a nice interface for editors to go in and change the text of the strings, since they can look them up either by translation or by key. I also wrote a nice utility that allows me to add, remove, rename, and test keys (i.e. translation strings). It’s working very well, but it would make review much easier if the source strings were alphabetical.

algorithm – Is the number of swap function calls and the number of swaps done while selection sort the same thing?

I know that for n elements, in selection sort:

Best cases: 1 swap done.
Worst cases: n-1 swaps done.
Average cases: (n-1)/2 swaps done.

So, if i were to say that the number of times the swap function has been called is same as the number of swaps done in 3 different cases, would I be correct?

Sort Numbers spreadsheet by how many times a value appears in a column

From this image you can see I’ve sorted the table by column G alphabetically, but what I would like to do is isolate the rows that only have one instance of the value in the G column. Most have multiple but as you can see with the pink dots some only have 1.

Is there a way to order by the amount of times a value occurs on a column?

Thanks

programming challenge – Sort Characters By Frequency Java

For context, I worked on the LeetCode May 2020 Challenge Week 3 Day 1. The challenge was described as this:

Given a string, sort it in decreasing order based on the frequency of
characters.

Example 1:

Input: `"tree"`

Output: `"eert"`

Explanation: `'e'` appears twice while `'r'` and `'t'` both appear once. So
`'e'` must appear before both `'r'` and `'t'`. Therefore `"eetr"` is also a

Example 2:

Input: `"cccaaa"`

Output: `"cccaaa"`

Explanation: Both `'c'` and `'a'` appear three times, so `"aaaccc"` is also
a valid answer. Note that `"cacaca"` is incorrect, as the same
characters must be together.

Example 3:

Input: `"Aabb"`

Output: `"bbAa"`

Explanation: `"bbaA"` is also a valid answer, but `"Aabb"` is incorrect.
Note that `'A'` and `'a'` are treated as two different characters.

Anyways, I looked up some popular solutions. One was to get the frequency of each character and sort, and the other was the use a heap. I liked both of these solutions, but I wanted to make one where there was no sorting.

My solution involved an idea of an `ArrayList` of “tiers,” where the index of the tier represents the frequency. Each tier consists of an `ArrayList` containing the characters which the corresponding frequency. As letters increase in frequency, the higher frequency tier they move up. I also used a `HashMap` to keep track of which frequency tier each character was in. Upon finishing iterating through the whole string, I simply use a `StringBuilder` to append the letters starting at the bottom tier, reverse the `StringBuilder`, then return the String. I was hoping someone could give me pointers (ha, code pun) on optimizing/modifying this approach without including any kind of sorting. Below is the functional code:

``````public static String frequencySort(String s) {
if (s.length() <= 1) return s;

ArrayList<ArrayList<Character>> tieredFreq = new ArrayList<>(); // stores characters at their proper frequency "tier"
HashMap<Character, Integer> tierOfChars = new HashMap<>(); // maps the characters to their current frequency tier

for (char c : s.toCharArray()) {
tierOfChars.put(c, tierOfChars.getOrDefault(c, 0) + 1); // add char or increment the tier of the character
int i = tierOfChars.get(c); // i = tier of the character
if (tieredFreq.size() <= i) tieredFreq.add(new ArrayList<>()); // if not enough tiers, add a new tier
if (i > 1) tieredFreq.get(i - 1).remove(new Character(c)); // if c exists in previous tier, remove it
}

StringBuilder result = new StringBuilder();
for (int i = 1; i < tieredFreq.size(); i++) { // iterate through tiers
ArrayList<Character> tier = tieredFreq.get(i); // get tier
for (Character c : tier) { // for each char in tier, append to string a number of times equal to the tier
for (int j = 0; j < i; j++) result.append(c);
}
}

result.reverse(); // reverse, since result is currently in ascending order
return result.toString();
}
``````

Review this Image Tool please (sort of online photoshop)

Review this Image Tool please (kinda online photoshop)

Hi,

https://vmapp.org/imageMake/logo.php

I don’t need HTML website design reviews, design is not done yet.
Review the tool please, quality of images its generating, is it easy enough to use etc. If you would like me to add something else etc.

This is not like regular “logo designers” which we come across online.
In those tools, webmasters have already made templates and you can just write your company’s name there.

This one is something more like photoshop, but online.
It can do some of the things that photoshop does, like color a random shape or text, gradient fill it, skew it, distort perspective it, drop different types of shadows, give a brightness shine effect to one side, etc.
Of course its not as advanced as photoshop, nowhere even close I think, but I tried to replicate some functionality using PHP alone, no imagemagic.

The parts I like most are control of gradient percentages, and the CSS type “auto positioning of layers”, and auto deciding suitable width and height of background.
Something like what browsers do with images and CSS float.

For example, while adding layers, instead of giving it a fixed x,y position on the background, you can give it a CSS value like “right”
When you will click “Make Logo” button, processing starts, and it will auto fit “this layer” to the right of “previous layer” processed.
Keywords supported are: “top, bottom, left, right”

The example image which you see at the bottom of the page, that is completely CSS styled, no fixed positions given.
The width and height of the total background was also auto decided by the tool itself, I only specified colors, left the “background width/height” section empty.

Once the image is made, it will be displayed at the bottom of the page (where default image is).

VMapp file is like a PSD file. You can later upload it and make modifications to existing images. No need to remake the whole thing again.
Basically a json set, nothing complicated…

You can move layers up/down much like how you use “align layers” in photoshop. Use the arrows next to a layer’s name.
By the way, that arrow was also made using this tool itself. Minimized a shape from the gallery too much and used the circle setting.

Another thing it supports is “short hand for colors”.
So if you want to have full white color, you need not type full hex “”FFFFFF” or “255.255.255”, simply type “f” or “ff” etc and it will accept it.
You can type just “b5” instead of “b5b5b5”

Try adding one or two text layers, one or two shape layers and click the “make logo” button.

When you make a new layer, click the “Add” button. “Save” button is to save changes to existing layers and not to save new layers.

Everything is keyboard based, excuse me for that. I did that so that even people with very bad eyesight can use it and they need not struggle with mouse…

My main concern is the quality of image that will be generated finally.

Thanks

Python – Selection Sort – Code Review Stack Exchange

I tried to create my first sort algorithm using Python. What do you think?

``````def selection_sort(data: List(int)) -> List(int):
unsorted_list: List(int) = data
sorted_list: List(int) = ()

for i, number in enumerate(unsorted_list):
# Insert new value
min_value = min(unsorted_list)
sorted_list.insert(i, min_value)

# Remove from unsorted
unsorted_list.remove(min_value)

return sorted_list
$$```$$
``````

What is the worst case Time Complexity for only the Divide Portion of the Merge Sort Algorithm?

Please, consider the below merge sort algorithm. Here we start with a divide portion which splits the array into halves and we do recursive operation on each half separately. I have ignored the merge portion of the algorithm to reduce complexity.

``````function mergeSort(unsortedArray)
{

let midpoint = Math.floor(unsortedArray.length/2);

if(unsortedArray.length == 1)
{
return unsortedArray;
}

let leftArray = mergeSort(unsortedArray.slice(0,midpoint));
let rightArray = mergeSort(unsortedArray.slice(midpoint,unsortedArray.length));

}
``````

I know for binary search tree which ignores half of the array in every iteration the answer would easily be arrived at as log2 n.

Now I would like to calculate the Worst Case Time Complexity for only the portion which splits the array into left half i.e. let leftArray = mergeSort(unsortedArray.slice(0,midpoint));

Even if the above code splits the array from index of 0 to midpoint. In the next level of recursion it would work on the entire array unlike Binary Search with index 0 to midpoint/2 going to left recursive call and index midpoint/2 to midpoint going to right recursive half.

So, How would we calculate Time complexity in a scenario where each level of recursion involves multiple recursive calls instead of one?

java – Does this code I wrote do what we expect from the quick sort algorithm?

``````package labodeva;
import java.util.Scanner;
public class odev5dene {
static int() quick(int kucuk,int buyuk,int() arr,int pivot) {
int bos() = new int(100);
int t=0;
if(arr(kucuk)<=arr(pivot)) {
kucuk++;
}
}
else{
bos(0) = arr(kucuk);
kucuk++;
}
}
bos(0) = arr(pivot);
}
if(pivot-1>0&&pivot+1<arr.length) {
quick(0,pivot-1,arr,0);
quick(pivot+1,arr.length-1,arr,pivot+1);
}
if(pivot+1<arr.length&&pivot-1<0) {
quick(pivot+1,arr.length-1,arr,pivot+1);
}
return arr;
}
public static void main(String() args) {
int a =0;
Scanner scan = new Scanner(System.in);
System.out.println("Please enter how many value do you want to add the array : ");
a=scan.nextInt();
int k() =new int(a);
for(int i=0;i<a;i++) {
k(i)=scan.nextInt();
}
k=quick(0,a-1,k,0); // it starts 0. element as pivot and goes on and also small and equal number value starts here big number value starts at the end of list
for(int i=0;i<a;i++) {
System.out.println(k(i));
}

}

}
``````

i wrote this code and it sorts the given array but i tried to do quicksort is this quicksort i am not sure can you check ?

Google Sheets – I want to 1) get unique names AND 2) remove vacancies AND 3) alpha sort AND 4) add last name, first name

I want to 1) get unique names AND 2) remove vacancies AND 3) alpha sort AND 4) add last name, first name.

The names are on Sheet1 and the results on Sheet2.

I use `=SORT(UNIQUE(Sheet1!A3:A), 1, TRUE)` To perform steps 1, 2, and 3, the first names on sheet 2 are deleted, but I don't know how to do step 4: get the corresponding last name on sheet 1 and append and insert it on sheet 1.